mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Merge 7b83c7d609 into merged_master (Bitcoin PR bitcoin/bitcoin#24510)
This commit is contained in:
commit
8715ef526d
1 changed files with 18 additions and 0 deletions
|
|
@ -8,6 +8,10 @@ from decimal import Decimal
|
|||
from test_framework.blocktools import COINBASE_MATURITY
|
||||
from test_framework import liquid_addr
|
||||
from test_framework.key import ECKey
|
||||
from test_framework.messages import (
|
||||
CMerkleBlock,
|
||||
from_hex,
|
||||
)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.script import hash160
|
||||
from test_framework.util import (
|
||||
|
|
@ -16,6 +20,7 @@ from test_framework.util import (
|
|||
)
|
||||
from test_framework.wallet_util import bytes_to_wif
|
||||
|
||||
|
||||
class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
|
|
@ -134,5 +139,18 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
w1.removeprunedfunds(txnid3)
|
||||
assert not [tx for tx in w1.listtransactions(include_watchonly=True) if tx['txid'] == txnid3]
|
||||
|
||||
# Check various RPC parameter validation errors
|
||||
assert_raises_rpc_error(-22, "TX decode failed", w1.importprunedfunds, b'invalid tx'.hex(), proof1)
|
||||
assert_raises_rpc_error(-5, "Transaction given doesn't exist in proof", w1.importprunedfunds, rawtxn2, proof1)
|
||||
|
||||
mb = from_hex(CMerkleBlock(), proof1)
|
||||
mb.header.hashMerkleRoot = 0xdeadbeef # cause mismatch between merkle root and merkle block
|
||||
assert_raises_rpc_error(-5, "Something wrong with merkleblock", w1.importprunedfunds, rawtxn1, mb.serialize().hex())
|
||||
|
||||
mb = from_hex(CMerkleBlock(), proof1)
|
||||
mb.header.nTime += 1 # modify arbitrary block header field to change block hash
|
||||
assert_raises_rpc_error(-5, "Block not found in chain", w1.importprunedfunds, rawtxn1, mb.serialize().hex())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ImportPrunedFundsTest().main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue