Skip to content

Commit

Permalink
Merge tag 'v0.22.0-beta'
Browse files Browse the repository at this point in the history
btcd v0.22.0-beta
  • Loading branch information
Elbandi committed Apr 12, 2022
2 parents 5cda86e + 63438c6 commit e6910db
Show file tree
Hide file tree
Showing 26 changed files with 610 additions and 100 deletions.
122 changes: 121 additions & 1 deletion CHANGES
Expand Up @@ -3,6 +3,126 @@ User visible changes for btcd
A full-node bitcoin implementation written in Go
============================================================================

Changes in 0.22.0 (Tue Jun 01 2021)
- Protocol and network-related changes:
- Add support for witness tx and block in notfound msg (#1625)
- Add support for receiving sendaddrv2 messages from a peer (#1670)
- Fix bug in peer package causing last block height to go backwards
(#1606)
- Add chain parameters for connecting to the public Signet network
(#1692, #1718)
- Crypto changes:
- Fix bug causing panic due to bad R and S signature components in
btcec.RecoverCompact (#1691)
- Set the name (secp256k1) in the CurveParams of the S256 curve
(#1565)
- Notable developer-related package changes:
- Remove unknown block version warning in the blockchain package,
due to false positives triggered by AsicBoost (#1463)
- Add chaincfg.RegisterHDKeyID function to populate HD key ID pairs
(#1617)
- Add new method mining.AddWitnessCommitment to add the witness
commitment as an OP_RETURN output within the coinbase transaction.
(#1716)
- RPC changes:
- Support Batch JSON-RPC in rpcclient and server (#1583)
- Add rpcclient method to invoke getdescriptorinfo JSON-RPC command
(#1578)
- Update the rpcserver handler for validateaddress JSON-RPC command to
have parity with the bitcoind 0.20.0 interface (#1613)
- Add rpcclient method to invoke getblockfilter JSON-RPC command
(#1579)
- Add signmessagewithprivkey JSON-RPC command in rpcserver (#1585)
- Add rpcclient method to invoke importmulti JSON-RPC command (#1579)
- Add watchOnly argument in rpcclient method to invoke
listtransactions JSON-RPC command (#1628)
- Update btcjson.ListTransactionsResult for compatibility with Bitcoin
Core 0.20.0 (#1626)
- Support nullable optional JSON-RPC parameters (#1594)
- Add rpcclient and server method to invoke getnodeaddresses JSON-RPC
command (#1590)
- Add rpcclient methods to invoke PSBT JSON-RPC commands (#1596)
- Add rpcclient method to invoke listsinceblock with the
include_watchonly parameter enabled (#1451)
- Add rpcclient method to invoke deriveaddresses JSON-RPC command
(#1631)
- Add rpcclient method to invoke getblocktemplate JSON-RPC command
(#1629)
- Add rpcclient method to invoke getaddressinfo JSON-RPC command
(#1633)
- Add rpcclient method to invoke getwalletinfo JSON-RPC command
(#1638)
- Fix error message in rpcserver when an unknown RPC command is
encountered (#1695)
- Fix error message returned by estimatefee when the number of blocks
exceeds the max depth (#1678)
- Update btcjson.GetBlockChainInfoResult to include new fields in
Bitcoin Core (#1676)
- Add ExtraHeaders in rpcclient.ConnConfig struct (#1669)
- Fix bitcoind compatibility issue with the sendrawtransaction
JSON-RPC command (#1659)
- Add new JSON-RPC errors to btcjson package, and documented them
(#1648)
- Add rpcclient method to invoke createwallet JSON-RPC command
(#1650)
- Add rpcclient methods to invoke backupwallet, dumpwallet, loadwallet
and unloadwallet JSON-RPC commands (#1645)
- Fix unmarshalling error in getmininginfo JSON-RPC command, for valid
integers in scientific notation (#1644)
- Add rpcclient method to invoke gettxoutsetinfo JSON-RPC command
(#1641)
- Add rpcclient method to invoke signrawtransactionwithwallet JSON-RPC
command (#1642)
- Add txid to getblocktemplate response of rpcserver (#1639)
- Fix monetary unit used in createrawtransaction JSON-RPC command in
rpcserver (#1614)
- Add rawtx field to btcjson.GetBlockVerboseTxResult to provide
backwards compatibility with older versions of Bitcoin Core (#1677)
- Misc changes:
- Update btcutil dependency (#1704)
- Add Dockerfile to build and run btcd on Docker (#1465)
- Rework documentation and publish on https://btcd.readthedocs.io (#1468)
- Add support for Go 1.15 (#1619)
- Add Go 1.14 as the minimum supported version of Golang (#1621)
- Contributors (alphabetical order):
- 10gic
- Andrew Tugarinov
- Anirudha Bose
- Appelberg-s
- Armando Ochoa
- Aurèle Oulès
- Calvin Kim
- Christian Lehmann
- Conner Fromknecht
- Dan Cline
- David Mazary
- Elliott Minns
- Federico Bond
- Friedger Müffke
- Gustavo Chain
- Hanjun Kim
- Henry Fisher
- Iskander Sharipov
- Jake Sylvestre
- Johan T. Halseth
- John C. Vernaleo
- Liran Sharir
- Mikael Lindlof
- Olaoluwa Osuntokun
- Oliver Gugger
- Rjected
- Steven Kreuzer
- Torkel Rogstad
- Tristyn
- Victor Lavaud
- Vinayak Borkar
- Wilmer Paulino
- Yaacov Akiba Slama
- ebiiim
- ipriver
- wakiyamap
- yyforyongyu

Changes in 0.21.0 (Thu Aug 27 2020)
- Network-related changes:
- Handle notfound messages from peers in netsync package (#1603)
Expand All @@ -26,7 +146,7 @@ Changes in 0.21.0 (Thu Aug 27 2020)
- Fix panic in fieldVal.SetByteSlice when called with large values, and
improve the method to be 35% faster (#1602)
- btcctl changes:
- Added -regtest mode to btcctl (#1556)
- Add -regtest mode to btcctl (#1556)
- Misc changes:
- Fix a bug due to a deadlock in connmgr's dynamic ban scoring (#1509)
- Add blockchain.NewUtxoEntry() to directly create entries for
Expand Down
10 changes: 0 additions & 10 deletions README.md
Expand Up @@ -40,8 +40,6 @@ which are both under active development.

## Installation

#### Windows - MSI Available

https://github.com/btcsuite/btcd/releases

#### Linux/BSD/MacOSX/POSIX - Build from Source
Expand Down Expand Up @@ -74,10 +72,6 @@ $ GO111MODULE=on go install -v . ./cmd/...

## Updating

#### Windows

Install a newer MSI

#### Linux/BSD/MacOSX/POSIX - Build from Source

- Run the following commands to update btcd, all dependencies, and install it:
Expand All @@ -94,10 +88,6 @@ btcd has several configuration options available to tweak how it runs, but all
of the basic operations described in the intro section work with zero
configuration.

#### Windows (Installed from MSI)

Launch btcd from your Start menu.

#### Linux/BSD/POSIX/Source

```bash
Expand Down
14 changes: 7 additions & 7 deletions addrmgr/addrmanager.go
Expand Up @@ -30,7 +30,7 @@ import (
// AddrManager provides a concurrency safe address manager for caching potential
// peers on the bitcoin network.
type AddrManager struct {
mtx sync.Mutex
mtx sync.RWMutex
peersFile string
lookupFunc func(string) ([]net.IP, error)
rand *rand.Rand
Expand Down Expand Up @@ -645,17 +645,17 @@ func (a *AddrManager) numAddresses() int {

// NumAddresses returns the number of addresses known to the address manager.
func (a *AddrManager) NumAddresses() int {
a.mtx.Lock()
defer a.mtx.Unlock()
a.mtx.RLock()
defer a.mtx.RUnlock()

return a.numAddresses()
}

// NeedMoreAddresses returns whether or not the address manager needs more
// addresses.
func (a *AddrManager) NeedMoreAddresses() bool {
a.mtx.Lock()
defer a.mtx.Unlock()
a.mtx.RLock()
defer a.mtx.RUnlock()

return a.numAddresses() < needAddressThreshold
}
Expand Down Expand Up @@ -685,8 +685,8 @@ func (a *AddrManager) AddressCache() []*wire.NetAddress {
// getAddresses returns all of the addresses currently found within the
// manager's address cache.
func (a *AddrManager) getAddresses() []*wire.NetAddress {
a.mtx.Lock()
defer a.mtx.Unlock()
a.mtx.RLock()
defer a.mtx.RUnlock()

addrIndexLen := len(a.addrIndex)
if addrIndexLen == 0 {
Expand Down
2 changes: 1 addition & 1 deletion btcjson/chainsvrresults.go
Expand Up @@ -764,7 +764,7 @@ type TxRawResult struct {
Size int32 `json:"size,omitempty"`
Vsize int32 `json:"vsize,omitempty"`
Weight int32 `json:"weight,omitempty"`
Version int32 `json:"version"`
Version uint32 `json:"version"`
LockTime uint32 `json:"locktime"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
Expand Down
28 changes: 28 additions & 0 deletions chaincfg/genesis.go
Expand Up @@ -170,3 +170,31 @@ var simNetGenesisBlock = wire.MsgBlock{
},
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
}

// sigNetGenesisHash is the hash of the first block in the block chain for the
// signet test network.
var sigNetGenesisHash = chainhash.Hash{
0xf6, 0x1e, 0xee, 0x3b, 0x63, 0xa3, 0x80, 0xa4,
0x77, 0xa0, 0x63, 0xaf, 0x32, 0xb2, 0xbb, 0xc9,
0x7c, 0x9f, 0xf9, 0xf0, 0x1f, 0x2c, 0x42, 0x25,
0xe9, 0x73, 0x98, 0x81, 0x08, 0x00, 0x00, 0x00,
}

// sigNetGenesisMerkleRoot is the hash of the first transaction in the genesis
// block for the signet test network. It is the same as the merkle root for
// the main network.
var sigNetGenesisMerkleRoot = genesisMerkleRoot

// sigNetGenesisBlock defines the genesis block of the block chain which serves
// as the public transaction ledger for the signet test network.
var sigNetGenesisBlock = wire.MsgBlock{
Header: wire.BlockHeader{
Version: 1,
PrevBlock: chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
MerkleRoot: sigNetGenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
Timestamp: time.Unix(1598918400, 0), // 2020-09-01 00:00:00 +0000 UTC
Bits: 0x1e0377ae, // 503543726 [00000377ae000000000000000000000000000000000000000000000000000000]
Nonce: 52613770,
},
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
}
68 changes: 68 additions & 0 deletions chaincfg/genesis_test.go
Expand Up @@ -118,6 +118,33 @@ func TestSimNetGenesisBlock(t *testing.T) {
}
}

// TestSigNetGenesisBlock tests the genesis block of the signet test network for
// validity by checking the encoded bytes and hashes.
func TestSigNetGenesisBlock(t *testing.T) {
// Encode the genesis block to raw bytes.
var buf bytes.Buffer
err := SigNetParams.GenesisBlock.Serialize(&buf)
if err != nil {
t.Fatalf("TestSigNetGenesisBlock: %v", err)
}

// Ensure the encoded block matches the expected bytes.
if !bytes.Equal(buf.Bytes(), sigNetGenesisBlockBytes) {
t.Fatalf("TestSigNetGenesisBlock: Genesis block does not "+
"appear valid - got %v, want %v",
spew.Sdump(buf.Bytes()),
spew.Sdump(sigNetGenesisBlockBytes))
}

// Check hash of the block against expected hash.
hash := SigNetParams.GenesisBlock.BlockHash()
if !SigNetParams.GenesisHash.IsEqual(&hash) {
t.Fatalf("TestSigNetGenesisBlock: Genesis block hash does "+
"not appear valid - got %v, want %v", spew.Sdump(hash),
spew.Sdump(SigNetParams.GenesisHash))
}
}

// genesisBlockBytes are the wire encoded bytes for the genesis block of the
// main network as of protocol version 60002.
var genesisBlockBytes = []byte{
Expand Down Expand Up @@ -281,3 +308,44 @@ var simNetGenesisBlockBytes = []byte{
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |.Lp+k.._|*/
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
}

// sigNetGenesisBlockBytes are the wire encoded bytes for the genesis block of
// the signet test network as of protocol version 70002.
var sigNetGenesisBlockBytes = []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |...@....| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x3b, 0xa3, 0xed, 0xfd, /* |........| */
0x7a, 0x7b, 0x12, 0xb2, 0x7a, 0xc7, 0x2c, 0x3e, /* |....;...| */
0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3, /* |z{..z.,>| */
0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, /* |gv.a....| */
0x4b, 0x1e, 0x5e, 0x4a, 0x00, 0x8f, 0x4d, 0x5f, /* |..Q2:...| */
0xae, 0x77, 0x03, 0x1e, 0x8a, 0xd2, 0x22, 0x03, /* |K.^J..M_| */
0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, /* |.w....".| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* |........| */
0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |........| */
0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, /* |..M.....| */
0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f, /* |..EThe T| */
0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, /* |imes 03/| */
0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c, /* |Jan/2009| */
0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, /* | Chancel| */
0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20, /* |lor on b| */
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, /* |rink of| */
0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66, /* |second b| */
0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, /* |ailout f| */
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, /* |or banks| */
0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, /* |........| */
0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, /* |*....CA.| */
0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, /* |g....UH'| */
0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, /* |.g..q0..| */
0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, /* |\..(.9..| */
0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, /* |yb...a..| */
0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, /* |I..?L.8.| */
0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, /* |.U......| */
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |\8M....W| */
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
}

0 comments on commit e6910db

Please sign in to comment.