lianad; update docs & tests for getinfo command

This commit is contained in:
pythcoiner 2025-03-17 08:00:01 +01:00
parent 091557a8df
commit 107e81071c
No known key found for this signature in database
GPG Key ID: C1048AEEDF303B88
2 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,8 @@ This command does not take any parameter for now.
| `rescan_progress` | float or null | Progress of an ongoing rescan as a percentage (between 0 and 1) if there is any |
| `timestamp` | integer | Unix timestamp of wallet creation date |
| `last_poll_timestamp`| integer or null | Unix timestamp of last poll (if any) of the blockchain |
| `receive_index` | integer | Last index used to generate a receive address |
| `change_index` | integer | Last index used to generate a change address |
### `getnewaddress`

View File

@ -36,6 +36,8 @@ def test_getinfo(lianad):
time.sleep(lianad.poll_interval_secs + 1)
res = lianad.rpc.getinfo()
assert res["last_poll_timestamp"] > last_poll_timestamp
assert res["receive_index"] == 0
assert res["change_index"] == 0
def test_getaddress(lianad):
@ -45,6 +47,9 @@ def test_getaddress(lianad):
assert res["address"] != lianad.rpc.getnewaddress()["address"]
# new address has derivation_index higher than the previous one
assert lianad.rpc.getnewaddress()["derivation_index"] == res["derivation_index"] + 2
info = lianad.rpc.getinfo()
assert info["receive_index"] == res["derivation_index"] + 3
assert info["change_index"] == 0
def test_listaddresses(lianad):
@ -420,6 +425,8 @@ def test_create_spend(lianad, bitcoind):
assert len(spend_psbt.o) == 4
assert len(spend_psbt.tx.vout) == 4
assert lianad.rpc.getinfo()["change_index"] == 15
# The transaction must contain the spent transaction for each input for P2WSH. But not for Taproot.
# We don't make assumptions about the ordering of PSBT inputs.
if USE_TAPROOT: