Changeset View
Changeset View
Standalone View
Standalone View
test/functional/signrawtransactions.py
Show All 38 Lines | def successful_signing_test(self): | ||||
# 1) The transaction has a complete set of signatures | # 1) The transaction has a complete set of signatures | ||||
assert 'complete' in rawTxSigned | assert 'complete' in rawTxSigned | ||||
assert_equal(rawTxSigned['complete'], True) | assert_equal(rawTxSigned['complete'], True) | ||||
# 2) No script verification error occurred | # 2) No script verification error occurred | ||||
assert 'errors' not in rawTxSigned | assert 'errors' not in rawTxSigned | ||||
# Check that signrawtransaction doesn't blow up on garbage merge | |||||
# attempts | |||||
dummyTxInconsistent = self.nodes[ | |||||
0].createrawtransaction([inputs[0]], outputs) | |||||
rawTxUnsigned = self.nodes[0].signrawtransaction( | |||||
rawTx + dummyTxInconsistent, inputs) | |||||
assert 'complete' in rawTxUnsigned | |||||
assert_equal(rawTxUnsigned['complete'], False) | |||||
# Check that signrawtransaction properly merges unsigned and signed | |||||
# txn, even with garbage in the middle | |||||
rawTxSigned2 = self.nodes[0].signrawtransaction( | |||||
rawTxUnsigned["hex"] + dummyTxInconsistent + rawTxSigned["hex"], inputs) | |||||
assert 'complete' in rawTxSigned2 | |||||
assert_equal(rawTxSigned2['complete'], True) | |||||
assert 'errors' not in rawTxSigned2 | |||||
def script_verification_error_test(self): | def script_verification_error_test(self): | ||||
"""Creates and signs a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script. | """Creates and signs a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script. | ||||
Expected results: | Expected results: | ||||
3) The transaction has no complete set of signatures | 3) The transaction has no complete set of signatures | ||||
4) Two script verification errors occurred | 4) Two script verification errors occurred | ||||
5) Script verification errors have certain properties ("txid", "vout", "scriptSig", "sequence", "error") | 5) Script verification errors have certain properties ("txid", "vout", "scriptSig", "sequence", "error") | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |