Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 addrmgr/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func IsRoutable(na *wire.NetAddressV2) bool {
IsRFC4843(lna) || IsRFC7343(lna) || IsRFC5737(lna) ||
IsRFC6598(lna) || IsLocal(lna) || IsZero(lna) ||
(IsRFC4193(lna) &&
!IsOnionCatTor(lna)))
!IsOnionCatTor(lna)))
}

// GroupKey returns a string representing the network group an address is part
Expand Down
3 changes: 3 additions & 0 deletions blockchain/accept_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func TestMaybeAcceptBlockReusesHeaderNode(t *testing.T) {
//
// genesis -> 1 -> 2 -> 3
tip := btcutil.NewBlock(params.GenesisBlock)
// Generated descendants must start at height 1 so the coinbase height
// encoding matches regtest's BIP34 rules.
tip.SetHeight(0)
_, _, err := addBlocks(3, chain, tip, []*testhelper.SpendableOut{})
if err != nil {
t.Fatalf("failed to build base chain: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion blockchain/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func chainedHeaders(parent *wire.BlockHeader, chainParams *chaincfg.Params,
merkle := chainhash.HashH(randBytes[:])

header := wire.BlockHeader{
Version: 1,
// Regtest enforces the BIP34/65/66 version floor from height 1.
Version: 4,
PrevBlock: tip.BlockHash(),
MerkleRoot: merkle,
Bits: chainParams.PowLimitBits,
Expand Down
4 changes: 2 additions & 2 deletions chaincfg/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ var RegressionNetParams = Params{
DeploymentEnder: NewMedianTimeDeploymentEnder(
time.Time{}, // Never expires.
),
MinActivationHeight: 0,
AlwaysActiveHeight: 1,
MinActivationHeight: 0,
AlwaysActiveHeight: 1,
CustomActivationThreshold: 108, // Only needs 75% hash rate.
},
},
Expand Down
20 changes: 13 additions & 7 deletions netsync/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,15 @@ func TestIsInIBDMode(t *testing.T) {
func createTestCoinbase(height int32, params *chaincfg.Params) *wire.MsgTx {
tx := wire.NewMsgTx(wire.TxVersion)

// Push the height as data to guarantee unique txids per block.
sigScript := []byte{
0x04,
byte(height), byte(height >> 8),
byte(height >> 16), byte(height >> 24),
// Encode the height as a minimally encoded script integer and add a trailing
// OP_0 so the script also satisfies the generic coinbase-length checks.
sigScript, err := txscript.NewScriptBuilder().
AddInt64(int64(height)).
AddInt64(0).
Script()
if err != nil {
panic(fmt.Sprintf("unable to encode coinbase height %d: %v",
height, err))
}

tx.AddTxIn(&wire.TxIn{
Expand Down Expand Up @@ -613,7 +617,8 @@ func generateTestBlocks(
merkleRoot := cb.TxHash()

header := wire.BlockHeader{
Version: 1,
// Regtest enforces the BIP34/65/66 version floor from height 1.
Version: 4,
PrevBlock: *prevHash,
MerkleRoot: merkleRoot,
Timestamp: prevTime.Add(time.Minute),
Expand Down Expand Up @@ -1187,7 +1192,8 @@ func TestStartSyncChainCurrent(t *testing.T) {
// IsCurrent() returns true.
cb := createTestCoinbase(1, &params)
header := wire.BlockHeader{
Version: 1,
// Regtest enforces the BIP34/65/66 version floor from height 1.
Version: 4,
PrevBlock: *params.GenesisHash,
MerkleRoot: cb.TxHash(),
Timestamp: time.Now().Truncate(time.Second),
Expand Down
Loading
Loading