mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-04 14:04:49 +02:00
QA: wallet_reindex: Use importdescriptors
directly rather than abusing test_framework's importaddress
wrapper
`importdescriptors` is expected to initialise wallet birth time to "now", but `importaddress` initialises it to 1 instead.
This commit is contained in:
parent
55bd5d8015
commit
0c38bbd194
@ -8,6 +8,7 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from test_framework.blocktools import COINBASE_MATURITY
|
from test_framework.blocktools import COINBASE_MATURITY
|
||||||
|
from test_framework.descriptors import descsum_create
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
@ -52,6 +53,14 @@ class WalletReindexTest(BitcoinTestFramework):
|
|||||||
# For a descriptors wallet: Import address with timestamp=now.
|
# For a descriptors wallet: Import address with timestamp=now.
|
||||||
# For legacy wallet: There is no way of importing a script/address with a custom time. The wallet always imports it with birthtime=1.
|
# For legacy wallet: There is no way of importing a script/address with a custom time. The wallet always imports it with birthtime=1.
|
||||||
# In both cases, disable rescan to not detect the transaction.
|
# In both cases, disable rescan to not detect the transaction.
|
||||||
|
if self.options.descriptors:
|
||||||
|
import_res = wallet_watch_only.importdescriptors([{
|
||||||
|
'desc': descsum_create('addr(' + wallet_addr + ')'),
|
||||||
|
'timestamp': 'now',
|
||||||
|
}])
|
||||||
|
assert len(import_res) == 1
|
||||||
|
assert import_res[0]['success']
|
||||||
|
else:
|
||||||
wallet_watch_only.importaddress(wallet_addr, rescan=False)
|
wallet_watch_only.importaddress(wallet_addr, rescan=False)
|
||||||
assert_equal(len(wallet_watch_only.listtransactions()), 0)
|
assert_equal(len(wallet_watch_only.listtransactions()), 0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user