lnwallet: ensure that each backend uses a distinct seed in integration tests
In this commit, we add an additional degree of isolation to the set of integration tests. A bug was recently fixed to ensure that the wallet always starts rescans from _after_ it's birthday. In the past it would miss some funds that were deposited _right_ before the birthday of the wallet. Fixing this bug exposed a test flake wherein the btcd node would itself rescan back and collect some of the funds that were last sent to the bitcoind node. In order to fix this, we now ensure that each backend will use a unique HD seed such that the tests are still deterministic for each backend and role.
This commit is contained in:
parent
1217992d9d
commit
2c8914e7bc
@ -2,6 +2,7 @@ package lnwallet_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@ -2104,6 +2105,7 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
|
||||
backEnd string, miningNode *rpctest.Harness,
|
||||
rpcConfig rpcclient.ConnConfig,
|
||||
chainNotifier *btcdnotify.BtcdNotifier) {
|
||||
|
||||
var (
|
||||
bio lnwallet.BlockChainIO
|
||||
|
||||
@ -2282,9 +2284,14 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
|
||||
t.Fatalf("unknown chain driver: %v", backEnd)
|
||||
}
|
||||
|
||||
aliceSeed := sha256.New()
|
||||
aliceSeed.Write([]byte(backEnd))
|
||||
aliceSeed.Write(aliceHDSeed[:])
|
||||
aliceSeedBytes := aliceSeed.Sum(nil)
|
||||
|
||||
aliceWalletConfig := &btcwallet.Config{
|
||||
PrivatePass: []byte("alice-pass"),
|
||||
HdSeed: aliceHDSeed[:],
|
||||
HdSeed: aliceSeedBytes,
|
||||
DataDir: tempTestDirAlice,
|
||||
NetParams: netParams,
|
||||
ChainSource: aliceClient,
|
||||
@ -2301,9 +2308,14 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
|
||||
keychain.CoinTypeTestnet,
|
||||
)
|
||||
|
||||
bobSeed := sha256.New()
|
||||
bobSeed.Write([]byte(backEnd))
|
||||
bobSeed.Write(bobHDSeed[:])
|
||||
bobSeedBytes := bobSeed.Sum(nil)
|
||||
|
||||
bobWalletConfig := &btcwallet.Config{
|
||||
PrivatePass: []byte("bob-pass"),
|
||||
HdSeed: bobHDSeed[:],
|
||||
HdSeed: bobSeedBytes,
|
||||
DataDir: tempTestDirBob,
|
||||
NetParams: netParams,
|
||||
ChainSource: bobClient,
|
||||
|
Loading…
Reference in New Issue
Block a user