Page MenuHomePhabricator

Refactor script_tests.cpp::PushSig() to have default SigHashType param
Open, WishlistPublic

Description

Setting the SigHashType param to default to SigHashType() will cleanup some of this test and reduces the chance of bugs by typo.

Event Timeline

jasonbcox created this task.Jan 25 2018, 23:20
jasonbcox triaged this task as Wishlist priority.

Hmm, PushSig already has default SigHashType parameter (introduced in D932):

TestBuilder &PushSig(const CKey &key,
                     SigHashType sigHashType = SigHashType(),
                     unsigned int lenR = 32, unsigned int lenS = 32,
                     Amount amount = Amount(0)) {

In most cases this function is called with key only (as in PushSig(keys.key2). In some cases, len is also overriden .PushSig(keys.key1, SigHashType(), 33, 32). In some cases cases only SigHasType is overriden PushSig(keys.key1, SigHashType().withAnyoneCanPay(true)));