Skip to content

Commit

Permalink
indexer: test and document witness version collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Nov 8, 2021
1 parent a40cb63 commit d6a13b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## unreleased

- Support for bech32m has been added. bcoin can now validate and send BTC to
addresses for witness programs with versions > 0. The address indexer has
also been updated to retrieve the new addresses. A bug was fixed where the
indexer may return data for a witness version 0 address even if a version 1
address was queried, if the two addresses had the same data (hash). After
upgrading bcoin, a full rescan may be necessary to re-index these collisions
correctly. To accomplish this:
- Stop bcoin (`bcoin-cli rpc stop` or `ctrl-C`)
- Delete the existing addr indexer data (`rm -rf ~/.bcoin/index/addr`)
- Restart bcoin
- The address indexer will automatically begin re-indexing the chain. It may take up to 24 hours.

- The logging module `blgr` has been updated. Log files will now be rolled over
at around 20 MB and timestamped. Only the last 10 log files will be kept on disk
and older log files will be purged. These values can be configured by passing
Expand Down
8 changes: 7 additions & 1 deletion test/indexer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ const vectors = [
addr: '2Muy8nSQaMsMFAZwPyiXSEMTVFJv9iYuhwT',
amount: 0.11,
label: 'p2sh'
},
// Same data part as version 0 p2wsh address but different witness version (1)
{
addr: 'bcrt1p2nj8e2nhmsa4hl9qw3xas7l5n2547h5uhlj47nc3pqfxaeq5rtjs0l3rl5',
amount: 0.22,
label: 'p2tr'
}
];

Expand Down Expand Up @@ -1033,7 +1039,7 @@ describe('Indexer', function() {
}
}

await forValue(node.mempool.map, 'size', 20);
await forValue(node.mempool.map, 'size', 25);
});

after(async () => {
Expand Down

0 comments on commit d6a13b0

Please sign in to comment.