diff --git a/jmbitcoin/jmbitcoin/secp256k1_transaction.py b/jmbitcoin/jmbitcoin/secp256k1_transaction.py index b9b2783..1c7bf63 100644 --- a/jmbitcoin/jmbitcoin/secp256k1_transaction.py +++ b/jmbitcoin/jmbitcoin/secp256k1_transaction.py @@ -223,6 +223,9 @@ def signature_form(tx, i, script, hashcode=SIGHASH_ALL): return serialize(signature_form(deserialize(tx), i, script, hashcode)) newtx = copy.deepcopy(tx) for inp in newtx["ins"]: + #If tx is passed in in segwit form, it must be switched to non-segwit. + if "txinwitness" in inp: + del inp["txinwitness"] inp["script"] = "" newtx["ins"][i]["script"] = script if hashcode & 0x1f == SIGHASH_NONE: diff --git a/jmclient/test/test_configure.py b/jmclient/test/test_configure.py index b94d1ba..44f9981 100644 --- a/jmclient/test/test_configure.py +++ b/jmclient/test/test_configure.py @@ -23,9 +23,9 @@ def test_load_config(): load_program_config(bs="regtest") os.makedirs("dummydirforconfig") ncp = os.path.join(os.getcwd(), "dummydirforconfig") - #need to erase remembered data in global config jm_single().config_location = "joinmarket.cfg" - load_program_config(config_path=ncp) + #TODO hack: the default config won't load on bitcoin-rpc; need to fix. + load_program_config(config_path=ncp, bs="blockr") os.remove("dummydirforconfig/joinmarket.cfg") os.removedirs("dummydirforconfig") jm_single().config_location = "joinmarket.cfg"