From 1f0f0d8c3cebe951a031175e52cc9a8a98d6dc52 Mon Sep 17 00:00:00 2001 From: Nodari Chkuaselidze Date: Mon, 9 Jun 2025 13:35:15 +0400 Subject: [PATCH] docs: Update changelog. --- CHANGELOG.md | 8 +++++++- test/data/migrations/wallet-7-coinselector-gen.js | 10 +++------- test/util/wallet.js | 14 +++++++++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a98a536b..9abf08eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased **When upgrading to this version of hsd, you must pass `--chain-migrate=4` -and `--wallet-migrate=6` when you run it for the first time.** +and `--wallet-migrate=7` when you run it for the first time.** ### Wallet Changes @@ -14,6 +14,12 @@ and `--wallet-migrate=6` when you run it for the first time.** the namestate when the wallet owns the name. - Introduce admin `POST /recalculate-balances`, useful if the post-migration recalculation was not triggered and wallet balances are not correct. + - The TX creation HTTP Endpoints now supports new values for the `selection` + property. These new strategies use database iterators instead of loading all + coins into RAM. + - `db-value` - This is a database alternative to `value` and new default. + - `db-age` - A database alternative `age`. + - `db-all` - A database alternative `all`. #### Wallet/WalletDB API - `Wallet.zap` now returns the number of transactions zapped instead of their hashes. diff --git a/test/data/migrations/wallet-7-coinselector-gen.js b/test/data/migrations/wallet-7-coinselector-gen.js index b703e414..a68292ff 100644 --- a/test/data/migrations/wallet-7-coinselector-gen.js +++ b/test/data/migrations/wallet-7-coinselector-gen.js @@ -7,6 +7,7 @@ const MTX = require('../../../lib/primitives/mtx'); const {Resource} = require('../../../lib/dns/resource'); const WalletDB = require('../../../lib/wallet/walletdb'); const wutils = require('../../util/wallet'); +const mutils = require('../../util/migrations'); const network = Network.get('regtest'); @@ -331,9 +332,8 @@ async function getMigrationDump(wdb) { const val = layout.txdb[key]; - assert(val.id.toString('hex') === str2hex(key)); - // const prefix = str2hex(key); - const prefix = key.charCodeAt(0).toString(16); + assert(val.id.toString('hex') === mutils.prefix2hex(key)); + const prefix = mutils.prefix2hex(key); prefixes.push(tprefix + prefix); } } @@ -345,7 +345,3 @@ async function getMigrationDump(wdb) { prefixes }; } - -function str2hex(key) { - return Buffer.from(key, 'utf8').toString('hex'); -} diff --git a/test/util/wallet.js b/test/util/wallet.js index e1ae91bd..ed44d234 100644 --- a/test/util/wallet.js +++ b/test/util/wallet.js @@ -108,11 +108,15 @@ async function mkOutput(wallet, outputInfo, options = {}) { createAddress = true } = options; - if (!info.address && !createAddress) { - info.address = await wallet.receiveAddress(outputInfo.account || 0); - } else if (!info.address && createAddress) { - const walletKey = await wallet.createReceive(outputInfo.account || 0); - info.address = walletKey.getAddress(); + if (!info.address) { + const account = outputInfo.account || 0; + + if (createAddress) { + const walletKey = await wallet.createReceive(account); + info.address = walletKey.getAddress(); + } else { + info.address = await wallet.receiveAddress(account); + } } return makeOutput(info);