Page MenuHomePhabricator

Cache script execution on a per transaction basis
ClosedPublic

Authored by deadalnix on Sep 6 2017, 12:21.

Details

Summary

This ensure that we do not run the same script twice with the same set of flags. because we check script when accepting a transaction in the mempool, this shoudl ensure that we do not run the script when connecting a new block.

This is based on core's PR10192 , but the structure is somewhat different (the cache is moved in its own file for instance).

Test Plan
make check
../qa/pull-tester/rpc-tests.py -extended

Run a node on testnet for a day, it looks like it all works well.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Sep 6 2017, 12:21
Herald added a reviewer: Restricted Project. · View Herald TranscriptSep 6 2017, 12:21
sickpig added a subscriber: sickpig.Sep 6 2017, 20:04
sickpig added inline comments.
src/script/scriptcache.cpp
1 ↗(On Diff #1330)

missing licence?

deadalnix updated this revision to Diff 1344.Sep 6 2017, 22:57

Fix licence

dagurval accepted this revision.Sep 7 2017, 19:53
dagurval added a subscriber: dagurval.
dagurval added inline comments.
src/script/scriptcache.cpp
55 ↗(On Diff #1344)

If IsKeyInScriptCache requires cs_main, shouldn't inserting also require cs_main? (AssertLockHeld(cs_main))

This revision is now accepted and ready to land.Sep 7 2017, 19:53
deadalnix added inline comments.Sep 7 2017, 23:15
src/script/scriptcache.cpp
55 ↗(On Diff #1344)

Yes.

This revision was automatically updated to reflect the committed changes.