Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
309 commits
Select commit Hold shift + click to select a range
d2669a7
wallet: benchmark `ListAddresses` API
mohamedawnallah Oct 6, 2025
8fc5eaa
wallet: benchmark `AddressInfo` API
mohamedawnallah Oct 6, 2025
3e70787
wallet: benchmark `GetUnusedAddress` API
mohamedawnallah Oct 6, 2025
30e5e5b
wallet: benchmark `NewAddress` API
mohamedawnallah Oct 6, 2025
d978172
wallet: benchmark `ImportPublicKey` API
mohamedawnallah Oct 6, 2025
2e08b4a
wallet: benchmark `ImportTaprootScript` API
mohamedawnallah Oct 6, 2025
e73ed28
wallet: benchmark `ScriptForOutput` API
mohamedawnallah Oct 6, 2025
38c426c
wallet: fix linting issues
mohamedawnallah Oct 10, 2025
1976d2d
wallet: add `UtxoManager` interface
yyforyongyu Sep 1, 2025
6f5df98
wallet: rename `ListUnspent` to `ListUnspentDeprecated`
yyforyongyu Sep 1, 2025
7043cef
wallet: rename `LeaseOutput` to `LeaseOutputDeprecated`
yyforyongyu Sep 1, 2025
6cb83e3
wallet: rename `ReleaseOutput` to `ReleaseOutputDeprecated`
yyforyongyu Sep 1, 2025
5a910c5
wallet: rename `ListLeasedOutputs` to `ListLeasedOutputsDeprecated`
yyforyongyu Sep 1, 2025
f94ec68
wallet+wtxmgr: add `TxStore` interface
yyforyongyu Sep 3, 2025
c8c1ecd
waddrmgr+wallet: add `AddrStore` interface
yyforyongyu Sep 4, 2025
f0c3347
waddrmgr+wallet: add `AccountStore` interface
yyforyongyu Sep 4, 2025
f5d492a
wallet: add mockers to be used in the unit tests
yyforyongyu Sep 4, 2025
8185bbd
wallet: fix chain params used in the tests
yyforyongyu Sep 4, 2025
77367ef
waddrmgr+wallet: implement `ListUnspent`
yyforyongyu Sep 2, 2025
2733d1a
wtxmgr: add new method `GetUtxo`
yyforyongyu Sep 3, 2025
dd9ec8d
wallet: implement `LeaseOutput`
yyforyongyu Sep 4, 2025
d51b147
wallet: implement `ReleaseOutput`
yyforyongyu Sep 4, 2025
2698234
wallet: implement `ListLeasedOutputs`
yyforyongyu Sep 4, 2025
27d8473
wallet: use `t.Context` in the tests
yyforyongyu Sep 9, 2025
3b0bc17
multi: fix linter errors
yyforyongyu Sep 9, 2025
36ac4bb
wallet: defer wallet start to caller
yyforyongyu Sep 10, 2025
98a8000
wallet: add wallet cleanup in `t.Cleanup`
yyforyongyu Sep 18, 2025
93eb889
wallet: fix linter `cyclop`
yyforyongyu Oct 10, 2025
0d4cfa8
wallet: setup benchmark wallet with outpoints
mohamedawnallah Oct 7, 2025
557f54f
wallet: benchmark `GetUtxo` API
mohamedawnallah Oct 7, 2025
ffea2f6
wallet: make sure the synced height is up-to-date
mohamedawnallah Oct 7, 2025
53a7741
wallet: benchmark `ListUnspent` API
mohamedawnallah Oct 7, 2025
a6729e1
wallet: benchmark `LeaseOutput` API
mohamedawnallah Oct 7, 2025
996b7ba
wallet: benchmark `ReleaseOutput` API
mohamedawnallah Oct 7, 2025
16e666a
wallet: benchmark `ListLeasedOutputs` API
mohamedawnallah Oct 7, 2025
4e840a4
wallet: introduce TxCreator interface and refined TxIntent
yyforyongyu Sep 15, 2025
f46f65f
wallet: add method `validateTxIntent`
yyforyongyu Sep 18, 2025
9f41873
wallet: add `getEligibleUTXOs` to select inputs based on input policy
yyforyongyu Sep 22, 2025
cee088e
wallet: add `createInputSource` to prepare inputs for the tx
yyforyongyu Sep 22, 2025
207d808
wallet: implement `CreateTransaction`
yyforyongyu Sep 22, 2025
3078fac
wallet: introduce interface `TxPublisher`
yyforyongyu Sep 22, 2025
d061d65
wallet: implement `CheckMempoolAcceptance`
yyforyongyu Sep 22, 2025
7573e6a
wallet: add `mockChain` using `mock.Mock`
yyforyongyu Sep 23, 2025
00a91a1
wallet: use `mockChain` instead in the unit tests
yyforyongyu Sep 23, 2025
7b36ccf
wallet: add helper method `checkMempool`
yyforyongyu Sep 23, 2025
7e6d562
wallet: add helper method `addTxToWallet`
yyforyongyu Sep 23, 2025
450dfc5
wallet: add methods `publishTx` and `removeUnminedTx`
yyforyongyu Sep 23, 2025
65fc40f
wallet: implement `Broadcast`
yyforyongyu Sep 23, 2025
3e5021b
wallet: fix `gosec` linter errors on int32 conversion
yyforyongyu Oct 10, 2025
a1ff692
waddrmgr: export the default account name
yyforyongyu Oct 13, 2025
ff0f27b
wallet: add `determineChangeSource` to fallback to default account
yyforyongyu Oct 13, 2025
b970d13
wallet: add nil check for `*wire.MsgTx`
yyforyongyu Oct 14, 2025
e113d60
wallet: fix linter `maintidx`
yyforyongyu Oct 14, 2025
6a7b7a6
wallet: fix linter `cyclop`
yyforyongyu Oct 31, 2025
b109984
wallet: rename `confirms -> calcConf` and `confirmed -> hasMinConfs`
yyforyongyu Nov 17, 2025
085744c
wallet: precompute owned_addrs <-> output_indices structure
mohamedawnallah Nov 16, 2025
50cfe41
wallet: adapt chain backend mock for later benchmarking
mohamedawnallah Nov 16, 2025
0d4544f
wallet: rename `mock.go` to `chain_mock_test.go`
mohamedawnallah Nov 16, 2025
5349613
wallet: refactor benchmarking framework
mohamedawnallah Nov 16, 2025
2fbea3c
wallet: benchmark `Broadcast` API serially
mohamedawnallah Nov 16, 2025
7096b03
wallet: benchmark `Broadcast` API concurrently
mohamedawnallah Nov 16, 2025
dc7c058
unit: add unit package
yyforyongyu Sep 25, 2025
861a31a
wallet: introduce `TxReader` interface
yyforyongyu Sep 25, 2025
c5f7cc0
wallet: implement `GetTx`
yyforyongyu Sep 25, 2025
93c1e1f
wallet: implement `ListTxns`
yyforyongyu Sep 25, 2025
5e8e525
wallet: add `TxWriter` interface and implementation
yyforyongyu Sep 25, 2025
52027b8
unit: refactor fee rate types to structs
yyforyongyu Oct 14, 2025
33087f6
unit: use big.Rat for fee rates
yyforyongyu Oct 15, 2025
fd5fab3
unit: improve test coverage from 65.1% to 100%
yyforyongyu Nov 10, 2025
50cdf8c
wallet+pkg: turn `VByte` and `WeightUnit` into structs for type safety
yyforyongyu Nov 10, 2025
2d3c7fb
refactor: rename unit package to btcunit
yyforyongyu Nov 12, 2025
c96b7df
wtxmgr: cache `SerializedTx` in `readRawTxRecord`
yyforyongyu Nov 12, 2025
18b22e2
waddrmgr: fix data race when accessing the ScopedKeyManager
yyforyongyu Nov 17, 2025
638cd71
wallet: include totalizer for confirmed and unconfirmed txs in benchm…
mohamedawnallah Nov 17, 2025
76d0b98
wallet: introduce tx patterns to benchmarking wallet
mohamedawnallah Nov 17, 2025
507f11e
wallet: benchmark `GetTx` API
mohamedawnallah Nov 17, 2025
d823c17
wallet: benchmark `GetTx` API concurrently
mohamedawnallah Nov 17, 2025
9c5f835
wallet: benchmark `ListTxns` API
mohamedawnallah Nov 17, 2025
c97cb6e
wallet: benchmark `ListTxns` API concurrently
mohamedawnallah Nov 17, 2025
c1cd0f8
wallet: benchmark `LabelTx` API
mohamedawnallah Nov 17, 2025
429d706
wallet: benchmark `LabelTx` API concurrently
mohamedawnallah Nov 17, 2025
57f8aa0
wallet: move existing signer methods to `deprecated.go`
yyforyongyu Sep 25, 2025
f93057a
wallet: add more mocks to prepare upcoming tests
yyforyongyu Sep 28, 2025
17afdc2
wallet: add `GetDerivationInfo` on `AddressManager`
yyforyongyu Sep 26, 2025
0b77df6
wallet: define `Signer` and `UnsafeSigner` interfaces
yyforyongyu Sep 28, 2025
e14fe5f
wallet: add `DerivePubKey` and `ECDH` to `Signer`
yyforyongyu Sep 28, 2025
7658965
wallet: add `SignMessage` and related types to `Signer`
yyforyongyu Sep 28, 2025
bb1e546
wallet: add `ComputeUnlockingScript` to `Signer`
yyforyongyu Sep 28, 2025
b722c1a
wallet: add `ComputeRawSig` and related types to `Signer`
yyforyongyu Sep 28, 2025
339f640
wallet: add unsafe methods to `UnsafeSigner`
yyforyongyu Sep 28, 2025
ee84b26
wallet: implement `DerivePubKey` and helpers
yyforyongyu Sep 28, 2025
fcd4cfd
wallet: implement `ECDH`
yyforyongyu Sep 28, 2025
b215e95
wallet: implement `SignMessage`
yyforyongyu Sep 28, 2025
1a7d6b7
wallet: implement `ComputeUnlockingScript`
yyforyongyu Sep 28, 2025
47f20ff
wallet: implement `ComputeRawSig`
yyforyongyu Sep 28, 2025
4df90e0
wallet: implement `UnsafeSigner` methods
yyforyongyu Sep 28, 2025
f9831df
wallet: Enforce security boundary in `ScriptForOutput`
yyforyongyu Sep 28, 2025
795e5b3
wallet: finalize `Signer` tests to increase test coverage
yyforyongyu Nov 24, 2025
07d864f
wallet: optimize test execution speed
yyforyongyu Nov 25, 2025
274f794
wallet: rename `SignMessage` to `SignDigest`
yyforyongyu Nov 25, 2025
9bfda4b
wallet: fix linter `goconst`
yyforyongyu Nov 25, 2025
495c88b
btcunit: add missing `KVByte` and `KWeightUnit` size units
yyforyongyu Nov 18, 2025
a0b0b0f
btcunit: Add comprehensive conversion and fee calculation methods
yyforyongyu Nov 18, 2025
ba6dd75
btcunit: rename `FeePer...` for clarity
yyforyongyu Nov 18, 2025
713eaee
btcunit: refactor transaction size units with baseUnit embedding
yyforyongyu Nov 18, 2025
3f6c6d7
btcunit+wallet: introduce baseFeeRate for precise fee calculations
yyforyongyu Nov 18, 2025
6e59d11
btcunit: implement `SatPerKWeight`
yyforyongyu Nov 18, 2025
edc7b3f
btcunit+wallet: refactor fee rate constructors for clarity and precision
yyforyongyu Nov 18, 2025
6ccd146
btcunit: add Val method for backward compatibility
yyforyongyu Nov 18, 2025
82d5e22
wallet: use `btcunit` for `TxIntent.FeeRate`
yyforyongyu Nov 18, 2025
467c44f
btcunit: panic on zero denominator in fee rate calculation
yyforyongyu Nov 28, 2025
24ab4f7
wallet: benchmark `DerivePubKey`
mohamedawnallah Nov 27, 2025
26ffb6f
wallet: benchmark `ECDH`
mohamedawnallah Nov 27, 2025
2547547
wallet: benchmark `SignDigestECDSA`
mohamedawnallah Nov 27, 2025
e4098e2
wallet: benchmark `SignDigestECDSACompact`
mohamedawnallah Nov 27, 2025
c572a94
wallet: benchmark `SignDigestSchnorr`
mohamedawnallah Nov 27, 2025
db48142
wallet: benchmark `ComputeUnlockingScriptP2WKH`
mohamedawnallah Nov 27, 2025
c322c11
wallet: benchmark `ComputeUnlockingScriptP2TR`
mohamedawnallah Nov 27, 2025
8d0dcda
wallet: benchmark `ComputeRawSigSegwitV0`
mohamedawnallah Nov 27, 2025
965a7ed
wallet: benchmark `ComputeRawSigTaproot`
mohamedawnallah Nov 27, 2025
0132527
wallet: benchmark `DerivePrivKey`
mohamedawnallah Nov 27, 2025
20da26d
wallet: benchmark `GetPrivKeyForAddress`
mohamedawnallah Nov 27, 2025
100360d
wallet: benchmark `SignDigestComparisonECDSAvsSchnorr`
mohamedawnallah Nov 27, 2025
a35cf54
wallet: benchmark `MultiInputTransaction`
mohamedawnallah Nov 27, 2025
88498db
wallet: benchmark `ComputeUnlockingScriptWithTweaker`
mohamedawnallah Nov 27, 2025
92ed3cb
wallet: benchmark `DifferentAddressTypes`
mohamedawnallah Nov 27, 2025
1fe0df5
wallet: fix data race in TestComputeUnlockingScriptFail
yyforyongyu Nov 27, 2025
0ecc931
wallet: add `PsbtManager` interface
yyforyongyu Nov 26, 2025
819f04b
wallet: move deprecated code in `deprecated.go`
yyforyongyu Nov 15, 2025
38b5293
wallet: deprecate existing PSBT methods
yyforyongyu Nov 17, 2025
35ad643
wallet: refactor `AddressManager` to extract the common helpers
yyforyongyu Nov 17, 2025
69ed41e
wallet: implement `DecorateInputs`
yyforyongyu Nov 17, 2025
229459f
wallet: implement `FundPsbt`
yyforyongyu Nov 19, 2025
70048a9
wallet: move deprecated PSBT methods into `deprecated.go`
yyforyongyu Nov 17, 2025
e92ae91
wallet: enforce nilness check in `validateFundIntent`
yyforyongyu Dec 11, 2025
e9dcf4d
wallet: add helper methods for `SignPsbt`
yyforyongyu Nov 25, 2025
5b05525
wallet: add validation and padding methods for `SignPsbt`
yyforyongyu Nov 25, 2025
7dd0e0a
wallet: implement `SignPsbt`
yyforyongyu Nov 25, 2025
b9017f0
wallet: fix linter error
yyforyongyu Dec 11, 2025
7c014d4
wallet: implement `FinalizePsbt`
yyforyongyu Nov 27, 2025
514d603
wallet: implement `CombinePsbt`
yyforyongyu Nov 26, 2025
3092632
wallet: remove file `psbt.go`
yyforyongyu Nov 26, 2025
edc7140
wallet: patch unit tests for existing helper methods
yyforyongyu Nov 26, 2025
077e437
wallet: add PSBT workflow docs
yyforyongyu Nov 26, 2025
a949d8b
wallet: consolidate PSBT errors and refactor manager
yyforyongyu Dec 16, 2025
5d28c49
wallet: use `slices.ContainsFunc`
yyforyongyu Dec 17, 2025
5ca4b9d
wallet: return error from `PsbtPrevOutputFetcher`
yyforyongyu Dec 17, 2025
888c3c5
wallet: add deduplicateTaprootScriptSpendSigs and its test
yyforyongyu Dec 17, 2025
b660d9d
waddrmgr: add `DeriveAddr` for efficient in-memory bulk derivation
yyforyongyu Dec 10, 2025
9be8896
chain+wallet: implement `GetCFilter` for chain backends
yyforyongyu Dec 10, 2025
b66554b
chain: use `NextAvailablePort`` for bitcoind test ports
yyforyongyu Dec 10, 2025
a6cf4b3
chain: add `testBitcoindClientGetCFilter` for bitcoind
yyforyongyu Dec 10, 2025
eb1a191
chain: fix linter errors in port.go
yyforyongyu Dec 11, 2025
400ec7d
chain: fix flake in `TestJitterTicker`
yyforyongyu Dec 18, 2025
a3234ea
chain: refactor `TestBitcoindEvents` to fix flakes
yyforyongyu Dec 18, 2025
1fdc169
chain: make tests more verbose
yyforyongyu Dec 18, 2025
dbd7a71
port: make sure max port can be reached
yyforyongyu Dec 22, 2025
592ce76
chain: add batch RPCs in btcd client
yyforyongyu Dec 16, 2025
29cd96f
chain: add batch RPCs in bitcoind client
yyforyongyu Dec 16, 2025
0e2714d
chain: add batch RPCs in neutrino client
yyforyongyu Dec 16, 2025
fab404d
chain+wallet: add batch RPCs on `chain.Interface`
yyforyongyu Dec 16, 2025
6c5994f
wtxmgr+wallet: add method `InsertConfirmedTx`
yyforyongyu Dec 15, 2025
673c5fa
waddrmgr+wallet: add more interface methods
yyforyongyu Dec 15, 2025
d166773
wallet: fix data race in `TestPopulatePsbtPacketErrors``
yyforyongyu Dec 19, 2025
423c377
wallet: rename lifecycle methods to *Deprecated
yyforyongyu Dec 2, 2025
64a943b
wallet: mark fields as deprecated
yyforyongyu Dec 20, 2025
cf3c637
wallet: move methods to deprecated.go
yyforyongyu Dec 20, 2025
b469bb4
wallet: refactor wallet.go by moving legacy methods to deprecated.go
yyforyongyu Dec 20, 2025
9d8b55f
wallet: move coin selection, key lookup, and locking to managers
yyforyongyu Dec 20, 2025
d902c76
wallet: refactor legacy logic from createtx and chainntfns
yyforyongyu Dec 20, 2025
53da11e
wallet: fix linter errors in tx_creator.go
yyforyongyu Dec 20, 2025
65de43c
wallet: fix existing linter errors
yyforyongyu Dec 22, 2025
2b80084
chain: eliminate redundant transaction notifications in bitcoind client
yyforyongyu Dec 21, 2025
27a09c8
wtxmgr: add method `InsertUnconfirmedTx`
yyforyongyu Dec 21, 2025
7a23c57
wallet: deprecate `Rescan`
yyforyongyu Dec 21, 2025
82ae674
wallet: fix PSBT unknown field merging and add tests
yyforyongyu Dec 24, 2025
7c8031c
wallet: fix existing linter errors
yyforyongyu Dec 25, 2025
9162a6f
wallet: mark deprecated methods in `recovery.go`
yyforyongyu Dec 23, 2025
b8bdc9a
wallet: move deprecated fields to deprecated.go
yyforyongyu Dec 23, 2025
05d7a40
wallet: fix `mockChain`
yyforyongyu Dec 25, 2025
2696218
golangci: ignore wrapcheck from `ctx.Err()`
yyforyongyu Dec 31, 2025
4db61de
gemini: ignore reviewing deprecated code and fix doc name
yyforyongyu Jan 13, 2026
7be22a6
docs: add design docs and ADRs
yyforyongyu Dec 24, 2025
7c42fa6
wallet: introduce `Controller` interface
yyforyongyu Dec 31, 2025
8466ac6
wallet: introduce chain `syncer` implementation
yyforyongyu Dec 31, 2025
061ea2c
wallet: implement orthogonal state model for atomic status tracking
yyforyongyu Dec 23, 2025
04e785a
wallet: strictly enforce CAS in lifecycle state transitions
yyforyongyu Jan 15, 2026
b1718a7
wallet: introduce `BranchRecoveryState` logic
yyforyongyu Dec 25, 2025
2ec74a9
wallet: expand `RecoveryState` to handle addr filters
yyforyongyu Jan 14, 2026
9a02e88
wallet: add block processing on `RecoveryState`
yyforyongyu Jan 14, 2026
6293608
wallet: patch unit tests for recovery logic
yyforyongyu Jan 14, 2026
da6681b
wallet: add database operation helpers for modernization
yyforyongyu Dec 23, 2025
2a49936
wallet: remove nolint
yyforyongyu Jan 13, 2026
b4bdc4e
wallet: implement lifecycle control loop and request handling
yyforyongyu Dec 23, 2025
022ff82
wallet: implement Controller `Start` method
yyforyongyu Dec 23, 2025
115b6f7
wallet: implement Controller `Stop` method
yyforyongyu Dec 23, 2025
2d79e7c
wallet: implement Controller `Lock` method
yyforyongyu Dec 23, 2025
9f88735
wallet: implement Controller `Unlock` method
yyforyongyu Dec 23, 2025
d578181
wallet: implement Controller `ChangePassphrase` method
yyforyongyu Dec 23, 2025
09bf03b
wallet: implement Controller `Info` method
yyforyongyu Dec 23, 2025
575b81d
wallet: make sure locking is idempotent
yyforyongyu Jan 15, 2026
465df6b
syncer: implement initial chain sync and reorg handling
yyforyongyu Dec 23, 2025
cbb9a27
syncer: implement full scan state loading and header-only scanning
yyforyongyu Dec 23, 2025
eededfd
syncer: implement full block scanning fallback
yyforyongyu Dec 23, 2025
d25caad
syncer: implement CFilter-based scanning
yyforyongyu Dec 23, 2025
4d9f789
syncer: implement scan strategy dispatching and main scan batching
yyforyongyu Dec 23, 2025
e54139c
syncer: implement chain synchronization advancement
yyforyongyu Dec 23, 2025
5719f7a
syncer: implement chain update and address extraction logic
yyforyongyu Dec 23, 2025
de424bd
syncer: implement scan request handling and targeted scanning
yyforyongyu Dec 23, 2025
9ca0e9f
syncer: implement main synchronization loop and broadcasting
yyforyongyu Dec 23, 2025
f84d7ee
wallet: implement Controller 'Rescan' and 'Resync' methods
yyforyongyu Dec 25, 2025
df98e20
wallet: fix linter errors
yyforyongyu Jan 14, 2026
79f24bb
gitignore: add coverage report file
yyforyongyu Dec 30, 2025
cb859d8
wallet: add test errors and improve wallet mock creation
yyforyongyu Jan 15, 2026
c699d48
wallet: add mockNeutrinoChain for interface compliance
yyforyongyu Jan 15, 2026
40994ba
wallet: refactor controller interruption tests to reduce complexity
yyforyongyu Jan 15, 2026
170beab
wallet: add comprehensive DB operation tests
yyforyongyu Jan 15, 2026
d0bb62a
wallet: expand syncer test coverage
yyforyongyu Jan 15, 2026
0e43ae5
wallet: address gemini reviews
yyforyongyu Jan 22, 2026
3a07cad
wallet: fix targeted scan loop and refactor TestScanWithTargets_Empty
yyforyongyu Jan 23, 2026
b6b8068
wallet: notify chain backend of new addresses in address manager
yyforyongyu Dec 21, 2025
034e95c
wallet: use `t.Context` in the tests
yyforyongyu Jan 15, 2026
89eae30
wallet: replace deprecated fields by using w.cfg
yyforyongyu Jan 23, 2026
e6a3e83
wallet: add wallet state checks to RPCs
yyforyongyu Jan 23, 2026
791b6d8
wtxmgr+wallet: add locked field to `CreditRecord` and `Credit`
yyforyongyu Jan 23, 2026
f491d0b
wallet: remove the usage of the deprecated methods
yyforyongyu Jan 19, 2026
d2f5eb6
waddrmgr+wallet: resolve race condition in address derivation
yyforyongyu Jan 23, 2026
f633c29
wallet: fix cyclop linter issues
yyforyongyu Jan 19, 2026
4ba44a0
wallet: move deprecated methods to `deprecated.go`
yyforyongyu Jan 19, 2026
2f16d04
wallet: remove the usage of `ImportAccountDeprecated`
yyforyongyu Jan 24, 2026
d38c7b3
wallet: update unit tests to use the new wallet
yyforyongyu Jan 23, 2026
dda36b8
wallet: move deprecated tests to deprecated_test.go
yyforyongyu Jan 23, 2026
8afc4bb
golangci+gemini: ignore `deprecated_test.go` and fix tab space
yyforyongyu Jan 21, 2026
161783a
wallet: introduce `CreateWalletParams`
yyforyongyu Jan 22, 2026
8a32692
wallet: add db method `DBCreateWallet`
yyforyongyu Jan 22, 2026
48eab09
wallet: add `validate` for `Config`
yyforyongyu Jan 22, 2026
6761c61
wallet: add `DBLoadWallet`
yyforyongyu Jan 22, 2026
a85b7f2
wallet: introduce wallet `Manager`
yyforyongyu Jan 22, 2026
3944cfc
wallet: build retry loop when syncer fails
yyforyongyu Jan 23, 2026
6e94b58
wallet: finalize `ModeShell`
yyforyongyu Jan 29, 2026
d3f0cf1
wallet: add validation for `CreateWalletParams`
yyforyongyu Jan 29, 2026
bfb7c70
wallet: fix linter cyclop
yyforyongyu Jan 29, 2026
3759fab
gitignore: ignore profile files
yyforyongyu Jan 27, 2026
a100179
wallet: validate `RecoveryWindow`
yyforyongyu Jan 27, 2026
99a652e
wallet: fix existing benchmark tests
yyforyongyu Jan 27, 2026
fe89b43
wallet: exit early when chain is synced
yyforyongyu Jan 27, 2026
8f3f8ae
wallet: add benchmarks to check syncing empty blocks
yyforyongyu Jan 27, 2026
b8b0eab
wallet: add benchmarks to check syncing with data
yyforyongyu Jan 27, 2026
2f32889
docs: add user docs for synchronization modes
yyforyongyu Jan 28, 2026
78ac6ae
wallet: complete btcd-v2 migration for interface-wallet rebase
yyforyongyu Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gemini/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ code_review:

# List of glob patterns to ignore (files and directories).
# Type: array of string, default: [].
ignore_patterns: []
ignore_patterns: ["deprecated.go"]
6 changes: 3 additions & 3 deletions .gemini/styleguide.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LND Style Guide
# Btcwallet Style Guide

## Code Documentation and Commenting

Expand All @@ -9,7 +9,7 @@
- Unit tests must always use the `require` library. Either table driven unit
tests or tests using the `rapid` library are preferred.
- The line length MUST NOT exceed 80 characters, this is very important.
You must count the Golang indentation (tabulator character) as 8 spaces when
You must count the Golang indentation (tabulator character) as 4 spaces when
determining the line length. Use creative approaches or the wrapping rules
specified below to make sure the line length isn't exceeded.
- Every function must be commented with its purpose and assumptions.
Expand Down Expand Up @@ -151,7 +151,7 @@ if amt < 546 {
### 80 character line length

- Wrap columns at 80 characters.
- Tabs are 8 spaces.
- Tabs are 4 spaces.

**WRONG**
```go
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ coverage.txt
.vscode
.DS_Store
.aider*
coverage.out
*.prof
*.test
*cpu.out
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ run:
linters:
default: all
disable:
# TODO(yy): Re-enable this linter once the refactoring series is done.
- ireturn

# Global variables are used in many places throughout the code base.
- gochecknoglobals

Expand Down Expand Up @@ -91,6 +94,19 @@ linters:
multi-func: true
multi-if: true

wrapcheck:
ignore-sig-regexps:
# Allow returning .Err() from context.Context without wrapping it.
- context\.Context.*\.Err\(\)

gomoddirectives:
replace-local: true
replace-allow-list:
# This package will be downgrade to internal so we will import it
# directly here.
- github.com/btcsuite/btcwallet/wtxmgr


# Defines a set of rules to ignore issues.
# It does not skip the analysis, and so does not ignore "typecheck" errors.
exclusions:
Expand All @@ -112,6 +128,7 @@ linters:
paths:
- rpc/legacyrpc/
- wallet/deprecated.go
- wallet/deprecated_test.go

rules:
# Exclude gosec from running for tests so that tests with weak randomness
Expand Down
12 changes: 9 additions & 3 deletions btcwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,16 @@ func rpcClientConnectLoop(legacyRPCServer *legacyrpc.Server, loader *wallet.Load
loadedWallet.SetChainSynced(false)

// TODO: Rework the wallet so changing the RPC client
// does not require stopping and restarting everything.
loadedWallet.Stop()
//nolint:staticcheck // This should be fixed once
// the interface refactor is finished, and new wallet
// RPC is built.
loadedWallet.StopDeprecated()
loadedWallet.WaitForShutdown()
loadedWallet.Start()

//nolint:staticcheck // This should be fixed once
// the interface refactor is finished, and new wallet
// RPC is built.
loadedWallet.StartDeprecated()
}
}
}
Expand Down
236 changes: 233 additions & 3 deletions chain/bitcoind_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"container/list"
"context"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"sync"
Expand All @@ -13,7 +14,10 @@ import (
"github.com/btcsuite/btcd/address/v2"
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/btcutil/v2"
"github.com/btcsuite/btcd/btcutil/v2/gcs"
"github.com/btcsuite/btcd/btcutil/v2/gcs/builder"
"github.com/btcsuite/btcd/chainhash/v2"
"github.com/btcsuite/btcd/rpcclient"
"github.com/btcsuite/btcd/txscript/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/btcsuite/btcwallet/waddrmgr"
Expand All @@ -26,6 +30,10 @@ var (
// to receive a notification for a specific item and the bitcoind client
// is in the middle of shutting down.
ErrBitcoindClientShuttingDown = errors.New("client is shutting down")

// ErrOnlyBasicFilters is an error returned when a filter type other
// than basic is requested.
ErrOnlyBasicFilters = errors.New("only basic filters are supported")
)

// BitcoindClient represents a persistent client connection to a bitcoind server
Expand All @@ -50,6 +58,15 @@ type BitcoindClient struct {
// the RPC and ZMQ connections to a bitcoind node.
chainConn *BitcoindConn

// batchClient is a secondary RPC client dedicated for batch requests.
// This client is created specifically for batch operations because the
// rpcclient.Client in batch mode is stateful, accumulating requests
// until `Send()` is called. Using a dedicated instance avoids race
// conditions and ensures isolation from other concurrent RPC calls
// made by the main `chainConn.client` or other `BitcoindClient`
// instances.
batchClient *rpcclient.Client

// bestBlock keeps track of the tip of the current best chain.
bestBlockMtx sync.RWMutex
bestBlock waddrmgr.BlockStamp
Expand Down Expand Up @@ -114,6 +131,56 @@ func (c *BitcoindClient) BackEnd() string {
return "bitcoind"
}

// GetCFilter returns a compact filter for the given block hash and filter
// type.
//
// NOTE: This is part of the chain.Interface interface.
func (c *BitcoindClient) GetCFilter(hash *chainhash.Hash,
filterType wire.FilterType) (*gcs.Filter, error) {

if filterType != wire.GCSFilterRegular {
return nil, ErrOnlyBasicFilters
}

// The getblockfilter RPC takes the block hash and the filter type.
// Filter type defaults to "basic" if omitted, but we specify it for
// clarity.
params := []json.RawMessage{
json.RawMessage(fmt.Sprintf("%q", hash.String())),
json.RawMessage(fmt.Sprintf("%q", "basic")),
}

resp, err := c.chainConn.client.RawRequest("getblockfilter", params)
if err != nil {
return nil, c.MapRPCErr(err)
}

var res struct {
Filter string `json:"filter"`
Header string `json:"header"`
}

err = json.Unmarshal(resp, &res)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal filter: %w", err)
}

filterBytes, err := hex.DecodeString(res.Filter)
if err != nil {
return nil, fmt.Errorf("failed to decode filter: %w", err)
}

filter, err := gcs.FromNBytes(
builder.DefaultP, builder.DefaultM, filterBytes,
)
if err != nil {
return nil, fmt.Errorf("failed to create filter from bytes: %w",
err)
}

return filter, nil
}

// GetBestBlock returns the highest block known to bitcoind.
func (c *BitcoindClient) GetBestBlock() (*chainhash.Hash, int32, error) {
bcinfo, err := c.chainConn.client.GetBlockChainInfo()
Expand Down Expand Up @@ -573,6 +640,9 @@ func (c *BitcoindClient) Stop() {
// prevent sending notifications to it after it's been stopped.
c.chainConn.RemoveClient(c.id)

c.batchClient.Shutdown()
c.batchClient.WaitForShutdown()

c.notificationQueue.Stop()
}

Expand Down Expand Up @@ -1185,8 +1255,13 @@ func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
// transaction.
blockDetails.Index = i
txDetails := btcutil.NewTx(tx)

// We disable individual transaction notifications here because
// the full set of relevant transactions will be dispatched
// atomically via FilteredBlockConnected at the end of block
// processing.
isRelevant, rec, err := c.filterTx(
txDetails, blockDetails, notify,
txDetails, blockDetails, false,
)
if err != nil {
log.Warnf("Unable to filter transaction %v: %v",
Expand Down Expand Up @@ -1349,8 +1424,9 @@ func (c *BitcoindClient) filterTx(txDetails *btcutil.Tx,
c.mempool[*txDetails.Hash()] = struct{}{}
}

c.onRelevantTx(rec, blockDetails)

if notify {
c.onRelevantTx(rec, blockDetails)
}
return true, rec, nil
}

Expand Down Expand Up @@ -1416,3 +1492,157 @@ func (c *BitcoindClient) updateWatchedFilters(update any) {
}
}
}

// GetBlockHashes returns a slice of block hashes for the given height range.
func (c *BitcoindClient) GetBlockHashes(startHeight,
endHeight int64) ([]chainhash.Hash, error) {

if startHeight > endHeight {
return nil, fmt.Errorf("%w: start height %d, end height %d",
ErrInvalidParam, startHeight, endHeight)
}

client := c.batchClient
count := endHeight - startHeight + 1
hashes := make([]chainhash.Hash, 0, count)
futures := make([]rpcclient.FutureGetBlockHashResult, 0, count)

for h := startHeight; h <= endHeight; h++ {
futures = append(futures, client.GetBlockHashAsync(h))
}

err := client.Send()
if err != nil {
return nil, fmt.Errorf("batch send: %w", err)
}

for _, f := range futures {
hash, err := f.Receive()
if err != nil {
return nil, fmt.Errorf("receive block hash: %w", err)
}

hashes = append(hashes, *hash)
}

return hashes, nil
}

// GetCFilters returns a slice of filters for the given block hashes.
func (c *BitcoindClient) GetCFilters(hashes []chainhash.Hash,
filterType wire.FilterType) ([]*gcs.Filter, error) {

if filterType != wire.GCSFilterRegular {
return nil, ErrOnlyBasicFilters
}

client := c.batchClient
filters := make([]*gcs.Filter, 0, len(hashes))
futures := make([]rpcclient.FutureRawResult, 0, len(hashes))

for _, hash := range hashes {
params := []json.RawMessage{
json.RawMessage(fmt.Sprintf("%q", hash.String())),
json.RawMessage(fmt.Sprintf("%q", "basic")),
}
futures = append(futures, client.RawRequestAsync(
"getblockfilter", params,
))
}

err := client.Send()
if err != nil {
return nil, fmt.Errorf("batch send: %w", err)
}

for _, f := range futures {
resp, err := f.Receive()
if err != nil {
return nil, fmt.Errorf("receive cfilter: %w", err)
}

var res struct {
Filter string `json:"filter"`
Header string `json:"header"`
}

err = json.Unmarshal(resp, &res)
if err != nil {
return nil, fmt.Errorf("unmarshal cfilter: %w", err)
}

filterBytes, err := hex.DecodeString(res.Filter)
if err != nil {
return nil, fmt.Errorf("decode cfilter: %w", err)
}

filter, err := gcs.FromNBytes(
builder.DefaultP, builder.DefaultM, filterBytes,
)
if err != nil {
return nil, fmt.Errorf("parse cfilter: %w", err)
}

filters = append(filters, filter)
}

return filters, nil
}

// GetBlocks returns a slice of full blocks for the given block hashes.
func (c *BitcoindClient) GetBlocks(hashes []chainhash.Hash) (
[]*wire.MsgBlock, error) {

client := c.batchClient
blocks := make([]*wire.MsgBlock, 0, len(hashes))
futures := make([]rpcclient.FutureGetBlockResult, 0, len(hashes))

for _, hash := range hashes {
futures = append(futures, client.GetBlockAsync(&hash))
}

err := client.Send()
if err != nil {
return nil, fmt.Errorf("batch send: %w", err)
}

for _, f := range futures {
block, err := f.Receive()
if err != nil {
return nil, fmt.Errorf("receive block: %w", err)
}

blocks = append(blocks, block)
}

return blocks, nil
}

// GetBlockHeaders returns a slice of block headers for the given block hashes.
func (c *BitcoindClient) GetBlockHeaders(hashes []chainhash.Hash) (
[]*wire.BlockHeader, error) {

client := c.batchClient
headers := make([]*wire.BlockHeader, 0, len(hashes))
futures := make([]rpcclient.FutureGetBlockHeaderResult, 0, len(hashes))

for _, hash := range hashes {
futures = append(futures, client.GetBlockHeaderAsync(&hash))
}

err := client.Send()
if err != nil {
return nil, fmt.Errorf("batch send: %w", err)
}

for _, f := range futures {
header, err := f.Receive()
if err != nil {
return nil, fmt.Errorf("receive header: %w", err)
}

headers = append(headers, header)
}

return headers, nil
}
Loading
Loading