updates for LBRY Blockchain #3
12 changed files with 295 additions and 242 deletions
|
@ -5,7 +5,12 @@
|
|||
|
||||
package chainhash
|
||||
|
||||
import "crypto/sha256"
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
|
||||
"golang.org/x/crypto/ripemd160"
|
||||
)
|
||||
|
||||
// HashB calculates hash(b) and returns the resulting bytes.
|
||||
func HashB(b []byte) []byte {
|
||||
|
@ -31,3 +36,26 @@ func DoubleHashH(b []byte) Hash {
|
|||
first := sha256.Sum256(b)
|
||||
return Hash(sha256.Sum256(first[:]))
|
||||
}
|
||||
|
||||
// LbryPoWHashH calculates returns the PoW Hash.
|
||||
//
|
||||
// doubled := SHA256(SHA256(b))
|
||||
// expanded := SHA512(doubled)
|
||||
// left := RIPEMD160(expanded[0:32])
|
||||
// right := RIPEMD160(expanded[32:64])
|
||||
// result := SHA256(SHA256(left||right))
|
||||
func LbryPoWHashH(b []byte) Hash {
|
||||
doubled := DoubleHashB(b)
|
||||
expanded := sha512.Sum512(doubled)
|
||||
|
||||
r := ripemd160.New()
|
||||
r.Reset()
|
||||
r.Write(expanded[:sha256.Size])
|
||||
left := r.Sum(nil)
|
||||
|
||||
r.Reset()
|
||||
r.Write(expanded[sha256.Size:])
|
||||
|
||||
combined := r.Sum(left)
|
||||
return DoubleHashH(combined)
|
||||
}
|
||||
|
|
|
@ -22,33 +22,22 @@ var genesisCoinbaseTx = wire.MsgTx{
|
|||
Index: 0xffffffff,
|
||||
},
|
||||
SignatureScript: []byte{
|
||||
0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, /* |.......E| */
|
||||
0x54, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, /* |The Time| */
|
||||
0x73, 0x20, 0x30, 0x33, 0x2f, 0x4a, 0x61, 0x6e, /* |s 03/Jan| */
|
||||
0x2f, 0x32, 0x30, 0x30, 0x39, 0x20, 0x43, 0x68, /* |/2009 Ch| */
|
||||
0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x6f, 0x72, /* |ancellor| */
|
||||
0x20, 0x6f, 0x6e, 0x20, 0x62, 0x72, 0x69, 0x6e, /* | on brin| */
|
||||
0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, /* |k of sec|*/
|
||||
0x6f, 0x6e, 0x64, 0x20, 0x62, 0x61, 0x69, 0x6c, /* |ond bail| */
|
||||
0x6f, 0x75, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, /* |out for |*/
|
||||
0x62, 0x61, 0x6e, 0x6b, 0x73, /* |banks| */
|
||||
0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x17,
|
||||
0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
|
||||
},
|
||||
Sequence: 0xffffffff,
|
||||
},
|
||||
},
|
||||
TxOut: []*wire.TxOut{
|
||||
{
|
||||
Value: 0x12a05f200,
|
||||
Value: 0x8e1bc9bf040000, // 400000000 * COIN
|
||||
PkScript: []byte{
|
||||
0x41, 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, /* |A.g....U| */
|
||||
0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, /* |H'.g..q0| */
|
||||
0xb7, 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, /* |..\..(.9| */
|
||||
0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, /* |..yb...a| */
|
||||
0xde, 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, /* |..I..?L.| */
|
||||
0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, /* |8..U....| */
|
||||
0x12, 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, /* |..\8M...| */
|
||||
0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, /* |.W.Lp+k.| */
|
||||
0x1d, 0x5f, 0xac, /* |._.| */
|
||||
0x76, 0xa9, 0x14, 0x34, 0x59, 0x91, 0xdb, 0xf5,
|
||||
0x7b, 0xfb, 0x01, 0x4b, 0x87, 0x00, 0x6a, 0xcd,
|
||||
0xfa, 0xfb, 0xfc, 0x5f, 0xe8, 0x29, 0x2f, 0x88,
|
||||
0xac,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -58,19 +47,28 @@ var genesisCoinbaseTx = wire.MsgTx{
|
|||
// genesisHash is the hash of the first block in the block chain for the main
|
||||
// network (genesis block).
|
||||
var genesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72,
|
||||
0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f,
|
||||
0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c,
|
||||
0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x63, 0xf4, 0x34, 0x6a, 0x4d, 0xb3, 0x4f, 0xdf,
|
||||
0xce, 0x29, 0xa7, 0x0f, 0x5e, 0x8d, 0x11, 0xf0,
|
||||
0x65, 0xf6, 0xb9, 0x16, 0x02, 0xb7, 0x03, 0x6c,
|
||||
0x7f, 0x22, 0xf3, 0xa0, 0x3b, 0x28, 0x89, 0x9c,
|
||||
})
|
||||
|
||||
// genesisMerkleRoot is the hash of the first transaction in the genesis block
|
||||
// for the main network.
|
||||
var genesisMerkleRoot = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
0x3b, 0xa3, 0xed, 0xfd, 0x7a, 0x7b, 0x12, 0xb2,
|
||||
0x7a, 0xc7, 0x2c, 0x3e, 0x67, 0x76, 0x8f, 0x61,
|
||||
0x7f, 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32,
|
||||
0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a,
|
||||
0xcc, 0x59, 0xe5, 0x9f, 0xf9, 0x7a, 0xc0, 0x92,
|
||||
0xb5, 0x5e, 0x42, 0x3a, 0xa5, 0x49, 0x51, 0x51,
|
||||
0xed, 0x6f, 0xb8, 0x05, 0x70, 0xa5, 0xbb, 0x78,
|
||||
0xcd, 0x5b, 0xd1, 0xc3, 0x82, 0x1c, 0x21, 0xb8,
|
||||
})
|
||||
|
||||
// genesisClaimTrie is the hash of the first transaction in the genesis block
|
||||
// for the main network.
|
||||
var genesisClaimTrie = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
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,
|
||||
})
|
||||
|
||||
// genesisBlock defines the genesis block of the block chain which serves as the
|
||||
|
@ -79,10 +77,11 @@ var genesisBlock = wire.MsgBlock{
|
|||
Header: wire.BlockHeader{
|
||||
Version: 1,
|
||||
PrevBlock: chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
|
||||
MerkleRoot: genesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
|
||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 18:15:05 +0000 UTC
|
||||
Bits: 0x1d00ffff, // 486604799 [00000000ffff0000000000000000000000000000000000000000000000000000]
|
||||
Nonce: 0x7c2bac1d, // 2083236893
|
||||
MerkleRoot: genesisMerkleRoot, // b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc
|
||||
ClaimTrie: genesisClaimTrie, // 0000000000000000000000000000000000000000000000000000000000000001
|
||||
Timestamp: time.Unix(1446058291, 0), // 28 Oct 2015 18:51:31 +0000 UTC
|
||||
Bits: 0x1f00ffff, // 486604799 [00000000ffff0000000000000000000000000000000000000000000000000000]
|
||||
Nonce: 0x00000507, // 1287
|
||||
},
|
||||
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
|
||||
}
|
||||
|
@ -90,10 +89,10 @@ var genesisBlock = wire.MsgBlock{
|
|||
// regTestGenesisHash is the hash of the first block in the block chain for the
|
||||
// regression test network (genesis block).
|
||||
var regTestGenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59,
|
||||
0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf,
|
||||
0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f,
|
||||
0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f,
|
||||
0x56, 0x75, 0x68, 0x69, 0x76, 0x67, 0x4f, 0x50,
|
||||
0xa0, 0xa1, 0x95, 0x3d, 0x17, 0x2e, 0x9e, 0xcf,
|
||||
0x4a, 0x4a, 0x62, 0x1d, 0xc9, 0xa4, 0xc3, 0x79,
|
||||
0x5d, 0xec, 0xd4, 0x99, 0x12, 0xcf, 0x3f, 0x6e,
|
||||
})
|
||||
|
||||
// regTestGenesisMerkleRoot is the hash of the first transaction in the genesis
|
||||
|
@ -107,10 +106,11 @@ var regTestGenesisBlock = wire.MsgBlock{
|
|||
Header: wire.BlockHeader{
|
||||
Version: 1,
|
||||
PrevBlock: chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
|
||||
MerkleRoot: regTestGenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
|
||||
Timestamp: time.Unix(1296688602, 0), // 2011-02-02 23:16:42 +0000 UTC
|
||||
MerkleRoot: regTestGenesisMerkleRoot, // b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc
|
||||
ClaimTrie: genesisClaimTrie, // 0000000000000000000000000000000000000000000000000000000000000001
|
||||
Timestamp: time.Unix(1446058291, 0), // 28 Oct 2015 18:51:31 +0000 UTC
|
||||
Bits: 0x207fffff, // 545259519 [7fffff0000000000000000000000000000000000000000000000000000000000]
|
||||
Nonce: 2,
|
||||
Nonce: 1,
|
||||
},
|
||||
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
|
||||
}
|
||||
|
@ -118,10 +118,10 @@ var regTestGenesisBlock = wire.MsgBlock{
|
|||
// testNet3GenesisHash is the hash of the first block in the block chain for the
|
||||
// test network (version 3).
|
||||
var testNet3GenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
0x43, 0x49, 0x7f, 0xd7, 0xf8, 0x26, 0x95, 0x71,
|
||||
0x08, 0xf4, 0xa3, 0x0f, 0xd9, 0xce, 0xc3, 0xae,
|
||||
0xba, 0x79, 0x97, 0x20, 0x84, 0xe9, 0x0e, 0xad,
|
||||
0x01, 0xea, 0x33, 0x09, 0x00, 0x00, 0x00, 0x00,
|
||||
0x63, 0xf4, 0x34, 0x6a, 0x4d, 0xb3, 0x4f, 0xdf,
|
||||
0xce, 0x29, 0xa7, 0x0f, 0x5e, 0x8d, 0x11, 0xf0,
|
||||
0x65, 0xf6, 0xb9, 0x16, 0x02, 0xb7, 0x03, 0x6c,
|
||||
0x7f, 0x22, 0xf3, 0xa0, 0x3b, 0x28, 0x89, 0x9c,
|
||||
})
|
||||
|
||||
// testNet3GenesisMerkleRoot is the hash of the first transaction in the genesis
|
||||
|
@ -135,10 +135,11 @@ var testNet3GenesisBlock = wire.MsgBlock{
|
|||
Header: wire.BlockHeader{
|
||||
Version: 1,
|
||||
PrevBlock: chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
|
||||
MerkleRoot: testNet3GenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
|
||||
Timestamp: time.Unix(1296688602, 0), // 2011-02-02 23:16:42 +0000 UTC
|
||||
Bits: 0x1d00ffff, // 486604799 [00000000ffff0000000000000000000000000000000000000000000000000000]
|
||||
Nonce: 0x18aea41a, // 414098458
|
||||
MerkleRoot: testNet3GenesisMerkleRoot, // b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc
|
||||
ClaimTrie: genesisClaimTrie, // 0000000000000000000000000000000000000000000000000000000000000001
|
||||
Timestamp: time.Unix(1446058291, 0), // 28 Oct 2015 18:51:31 +0000 UTC
|
||||
Bits: 0x1f00ffff, // 486604799 [00000000ffff0000000000000000000000000000000000000000000000000000]
|
||||
Nonce: 0x00000507, // 1287
|
||||
},
|
||||
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
|
||||
}
|
||||
|
@ -146,10 +147,10 @@ var testNet3GenesisBlock = wire.MsgBlock{
|
|||
// simNetGenesisHash is the hash of the first block in the block chain for the
|
||||
// simulation test network.
|
||||
var simNetGenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
|
||||
0xf6, 0x7a, 0xd7, 0x69, 0x5d, 0x9b, 0x66, 0x2a,
|
||||
0x72, 0xff, 0x3d, 0x8e, 0xdb, 0xbb, 0x2d, 0xe0,
|
||||
0xbf, 0xa6, 0x7b, 0x13, 0x97, 0x4b, 0xb9, 0x91,
|
||||
0x0d, 0x11, 0x6d, 0x5c, 0xbd, 0x86, 0x3e, 0x68,
|
||||
0xbb, 0x49, 0xc5, 0x8d, 0x58, 0x48, 0x19, 0x14,
|
||||
0x1a, 0xda, 0x76, 0x4a, 0xc9, 0x9f, 0xfe, 0xe0,
|
||||
0xf3, 0x4f, 0x8c, 0xd4, 0x6d, 0x37, 0x3b, 0x1e,
|
||||
0x06, 0xec, 0x23, 0x48, 0xea, 0xc9, 0x7b, 0x9d,
|
||||
})
|
||||
|
||||
// simNetGenesisMerkleRoot is the hash of the first transaction in the genesis
|
||||
|
|
|
@ -125,38 +125,31 @@ var genesisBlockBytes = []byte{
|
|||
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, /* |z{..z.,>| */
|
||||
0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3, /* |gv.a....| */
|
||||
0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, /* |..Q2:...| */
|
||||
0x4b, 0x1e, 0x5e, 0x4a, 0x29, 0xab, 0x5f, 0x49, /* |K.^J)._I| */
|
||||
0xff, 0xff, 0x00, 0x1d, 0x1d, 0xac, 0x2b, 0x7c, /* |......+|| */
|
||||
0x00, 0x00, 0x00, 0x00, 0xcc, 0x59, 0xe5, 0x9f, /* |.....Y..| */
|
||||
0xf9, 0x7a, 0xc0, 0x92, 0xb5, 0x5e, 0x42, 0x3a, /* |.z...^B:| */
|
||||
0xa5, 0x49, 0x51, 0x51, 0xed, 0x6f, 0xb8, 0x05, /* |.IQQ.o..| */
|
||||
0x70, 0xa5, 0xbb, 0x78, 0xcd, 0x5b, 0xd1, 0xc3, /* |p..x.[..| */
|
||||
0x82, 0x1c, 0x21, 0xb8, 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, 0x33, 0x19, 0x31, 0x56, /* |....3.1V| */
|
||||
0xff, 0xff, 0x00, 0x1f, 0x07, 0x05, 0x00, 0x00, /* |........| */
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 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, 0xff, 0xff, /* |........| */
|
||||
0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |..M.....| */
|
||||
0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, /* |..EThe T| */
|
||||
0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f, /* |imes 03/| */
|
||||
0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, /* |Jan/2009| */
|
||||
0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c, /* | Chancel| */
|
||||
0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, /* |lor on b| */
|
||||
0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20, /* |rink of | */
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, /* |second b| */
|
||||
0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66, /* |ailout f| */
|
||||
0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, /* |or banks| */
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, /* |........| */
|
||||
0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, /* |*....CA.| */
|
||||
0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, /* |g....UH'| */
|
||||
0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, /* |.g..q0..| */
|
||||
0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, /* |\..(.9..| */
|
||||
0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, /* |yb...a..| */
|
||||
0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, /* |I..?L.8.| */
|
||||
0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, /* |.U......| */
|
||||
0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, /* |\8M....W| */
|
||||
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |.Lp+k.._|*/
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
0xff, 0xff, 0x1f, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |........| */
|
||||
0x01, 0x04, 0x17, 0x69, 0x6e, 0x73, 0x65, 0x72, /* |...inser| */
|
||||
0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, /* |t timest| */
|
||||
0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x72, 0x69, /* |amp stri| */
|
||||
0x6e, 0x67, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* |ng......| */
|
||||
0x00, 0x04, 0xbf, 0xc9, 0x1b, 0x8e, 0x00, 0x19, /* |........| */
|
||||
0x76, 0xa9, 0x14, 0x34, 0x59, 0x91, 0xdb, 0xf5, /* |v..4Y...| */
|
||||
0x7b, 0xfb, 0x01, 0x4b, 0x87, 0x00, 0x6a, 0xcd, /* |{..K..j.| */
|
||||
0xfa, 0xfb, 0xfc, 0x5f, 0xe8, 0x29, 0x2f, 0x88, /* |..._.)/.| */
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
}
|
||||
|
||||
// regTestGenesisBlockBytes are the wire encoded bytes for the genesis block of
|
||||
|
@ -166,38 +159,32 @@ var regTestGenesisBlockBytes = []byte{
|
|||
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, /* |z{..z.,>| */
|
||||
0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3, /* |gv.a....| */
|
||||
0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, /* |..Q2:...| */
|
||||
0x4b, 0x1e, 0x5e, 0x4a, 0xda, 0xe5, 0x49, 0x4d, /* |K.^J)._I| */
|
||||
0xff, 0xff, 0x7f, 0x20, 0x02, 0x00, 0x00, 0x00, /* |......+|| */
|
||||
0x00, 0x00, 0x00, 0x00, 0xcc, 0x59, 0xe5, 0x9f, /* |.....Y..| */
|
||||
0xf9, 0x7a, 0xc0, 0x92, 0xb5, 0x5e, 0x42, 0x3a, /* |.z...^B:| */
|
||||
0xa5, 0x49, 0x51, 0x51, 0xed, 0x6f, 0xb8, 0x05, /* |.IQQ.o..| */
|
||||
0x70, 0xa5, 0xbb, 0x78, 0xcd, 0x5b, 0xd1, 0xc3, /* |p..x.[..| */
|
||||
0x82, 0x1c, 0x21, 0xb8, 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, 0x33, 0x19, 0x31, 0x56, /* |....3.1V| */
|
||||
0xff, 0xff, 0x7f, 0x20, 0x01, 0x00, 0x00, 0x00, /* |... ....| */
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 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, 0xff, 0xff, /* |........| */
|
||||
0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |..M.....| */
|
||||
0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, /* |..EThe T| */
|
||||
0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f, /* |imes 03/| */
|
||||
0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, /* |Jan/2009| */
|
||||
0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c, /* | Chancel| */
|
||||
0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, /* |lor on b| */
|
||||
0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20, /* |rink of | */
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, /* |second b| */
|
||||
0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66, /* |ailout f| */
|
||||
0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, /* |or banks| */
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, /* |........| */
|
||||
0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, /* |*....CA.| */
|
||||
0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, /* |g....UH'| */
|
||||
0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, /* |.g..q0..| */
|
||||
0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, /* |\..(.9..| */
|
||||
0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, /* |yb...a..| */
|
||||
0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, /* |I..?L.8.| */
|
||||
0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, /* |.U......| */
|
||||
0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, /* |\8M....W| */
|
||||
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |.Lp+k.._|*/
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
0xff, 0xff, 0x1f, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |........| */
|
||||
0x01, 0x04, 0x17, 0x69, 0x6e, 0x73, 0x65, 0x72, /* |...inser| */
|
||||
0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, /* |t timest| */
|
||||
0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x72, 0x69, /* |amp stri| */
|
||||
0x6e, 0x67, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* |ng......| */
|
||||
0x00, 0x04, 0xbf, 0xc9, 0x1b, 0x8e, 0x00, 0x19, /* |........| */
|
||||
0x76, 0xa9, 0x14, 0x34, 0x59, 0x91, 0xdb, 0xf5, /* |v..4Y...| */
|
||||
0x7b, 0xfb, 0x01, 0x4b, 0x87, 0x00, 0x6a, 0xcd, /* |{..K..j.| */
|
||||
0xfa, 0xfb, 0xfc, 0x5f, 0xe8, 0x29, 0x2f, 0x88, /* |..._.)/.| */
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
|
||||
}
|
||||
|
||||
// testNet3GenesisBlockBytes are the wire encoded bytes for the genesis block of
|
||||
|
@ -207,38 +194,31 @@ var testNet3GenesisBlockBytes = []byte{
|
|||
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, /* |z{..z.,>| */
|
||||
0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3, /* |gv.a....| */
|
||||
0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, /* |..Q2:...| */
|
||||
0x4b, 0x1e, 0x5e, 0x4a, 0xda, 0xe5, 0x49, 0x4d, /* |K.^J)._I| */
|
||||
0xff, 0xff, 0x00, 0x1d, 0x1a, 0xa4, 0xae, 0x18, /* |......+|| */
|
||||
0x00, 0x00, 0x00, 0x00, 0xcc, 0x59, 0xe5, 0x9f, /* |.....Y..| */
|
||||
0xf9, 0x7a, 0xc0, 0x92, 0xb5, 0x5e, 0x42, 0x3a, /* |.z...^B:| */
|
||||
0xa5, 0x49, 0x51, 0x51, 0xed, 0x6f, 0xb8, 0x05, /* |.IQQ.o..| */
|
||||
0x70, 0xa5, 0xbb, 0x78, 0xcd, 0x5b, 0xd1, 0xc3, /* |p..x.[..| */
|
||||
0x82, 0x1c, 0x21, 0xb8, 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, 0x33, 0x19, 0x31, 0x56, /* |....3.1V| */
|
||||
0xff, 0xff, 0x00, 0x1f, 0x07, 0x05, 0x00, 0x00, /* |........| */
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 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, 0xff, 0xff, /* |........| */
|
||||
0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |..M.....| */
|
||||
0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, /* |..EThe T| */
|
||||
0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f, /* |imes 03/| */
|
||||
0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, /* |Jan/2009| */
|
||||
0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c, /* | Chancel| */
|
||||
0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, /* |lor on b| */
|
||||
0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20, /* |rink of | */
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, /* |second b| */
|
||||
0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66, /* |ailout f| */
|
||||
0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, /* |or banks| */
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, /* |........| */
|
||||
0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, /* |*....CA.| */
|
||||
0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, /* |g....UH'| */
|
||||
0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, /* |.g..q0..| */
|
||||
0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, /* |\..(.9..| */
|
||||
0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, /* |yb...a..| */
|
||||
0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, /* |I..?L.8.| */
|
||||
0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, /* |.U......| */
|
||||
0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, /* |\8M....W| */
|
||||
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |.Lp+k.._|*/
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
0xff, 0xff, 0x1f, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |........| */
|
||||
0x01, 0x04, 0x17, 0x69, 0x6e, 0x73, 0x65, 0x72, /* |...inser| */
|
||||
0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, /* |t timest| */
|
||||
0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x72, 0x69, /* |amp stri| */
|
||||
0x6e, 0x67, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* |ng......| */
|
||||
0x00, 0x04, 0xbf, 0xc9, 0x1b, 0x8e, 0x00, 0x19, /* |........| */
|
||||
0x76, 0xa9, 0x14, 0x34, 0x59, 0x91, 0xdb, 0xf5, /* |v..4Y...| */
|
||||
0x7b, 0xfb, 0x01, 0x4b, 0x87, 0x00, 0x6a, 0xcd, /* |{..K..j.| */
|
||||
0xfa, 0xfb, 0xfc, 0x5f, 0xe8, 0x29, 0x2f, 0x88, /* |..._.)/.| */
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
}
|
||||
|
||||
// simNetGenesisBlockBytes are the wire encoded bytes for the genesis block of
|
||||
|
@ -248,36 +228,29 @@ var simNetGenesisBlockBytes = []byte{
|
|||
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, /* |z{..z.,>| */
|
||||
0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3, /* |gv.a....| */
|
||||
0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, /* |..Q2:...| */
|
||||
0x4b, 0x1e, 0x5e, 0x4a, 0x45, 0x06, 0x86, 0x53, /* |K.^J)._I| */
|
||||
0xff, 0xff, 0x7f, 0x20, 0x02, 0x00, 0x00, 0x00, /* |......+|| */
|
||||
0x00, 0x00, 0x00, 0x00, 0xcc, 0x59, 0xe5, 0x9f, /* |.....Y..| */
|
||||
0xf9, 0x7a, 0xc0, 0x92, 0xb5, 0x5e, 0x42, 0x3a, /* |.z...^B:| */
|
||||
0xa5, 0x49, 0x51, 0x51, 0xed, 0x6f, 0xb8, 0x05, /* |.IQQ.o..| */
|
||||
0x70, 0xa5, 0xbb, 0x78, 0xcd, 0x5b, 0xd1, 0xc3, /* |p..x.[..| */
|
||||
0x82, 0x1c, 0x21, 0xb8, 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, 0x45, 0x06, 0x86, 0x53, /* |....E..S| */
|
||||
0xff, 0xff, 0x7f, 0x20, 0x02, 0x00, 0x00, 0x00, /* |... ....| */
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 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, 0xff, 0xff, /* |........| */
|
||||
0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |..M.....| */
|
||||
0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, /* |..EThe T| */
|
||||
0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f, /* |imes 03/| */
|
||||
0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, /* |Jan/2009| */
|
||||
0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c, /* | Chancel| */
|
||||
0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, /* |lor on b| */
|
||||
0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20, /* |rink of | */
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, /* |second b| */
|
||||
0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66, /* |ailout f| */
|
||||
0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, /* |or banks| */
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, /* |........| */
|
||||
0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, /* |*....CA.| */
|
||||
0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, /* |g....UH'| */
|
||||
0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, /* |.g..q0..| */
|
||||
0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, /* |\..(.9..| */
|
||||
0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, /* |yb...a..| */
|
||||
0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, /* |I..?L.8.| */
|
||||
0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, /* |.U......| */
|
||||
0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, /* |\8M....W| */
|
||||
0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, /* |.Lp+k.._|*/
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
0xff, 0xff, 0x1f, 0x04, 0xff, 0xff, 0x00, 0x1d, /* |........| */
|
||||
0x01, 0x04, 0x17, 0x69, 0x6e, 0x73, 0x65, 0x72, /* |...inser| */
|
||||
0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, /* |t timest| */
|
||||
0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x72, 0x69, /* |amp stri| */
|
||||
0x6e, 0x67, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* |ng......| */
|
||||
0x00, 0x04, 0xbf, 0xc9, 0x1b, 0x8e, 0x00, 0x19, /* |........| */
|
||||
0x76, 0xa9, 0x14, 0x34, 0x59, 0x91, 0xdb, 0xf5, /* |v..4Y...| */
|
||||
0x7b, 0xfb, 0x01, 0x4b, 0x87, 0x00, 0x6a, 0xcd, /* |{..K..j.| */
|
||||
0xfa, 0xfb, 0xfc, 0x5f, 0xe8, 0x29, 0x2f, 0x88, /* |..._.)/.| */
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, /* |.....| */
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ var (
|
|||
bigOne = big.NewInt(1)
|
||||
|
||||
// mainPowLimit is the highest proof of work value a Bitcoin block can
|
||||
// have for the main network. It is the value 2^224 - 1.
|
||||
mainPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 224), bigOne)
|
||||
// have for the main network. It is the value 2^240 - 1.
|
||||
mainPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 240), bigOne)
|
||||
|
||||
// regressionPowLimit is the highest proof of work value a Bitcoin block
|
||||
// can have for the regression test network. It is the value 2^255 - 1.
|
||||
|
@ -32,8 +32,8 @@ var (
|
|||
|
||||
// testNet3PowLimit is the highest proof of work value a Bitcoin block
|
||||
// can have for the test network (version 3). It is the value
|
||||
// 2^224 - 1.
|
||||
testNet3PowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 224), bigOne)
|
||||
// 2^240 - 1.
|
||||
testNet3PowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 240), bigOne)
|
||||
|
||||
// simNetPowLimit is the highest proof of work value a Bitcoin block
|
||||
// can have for the simulation test network. It is the value 2^255 - 1.
|
||||
|
@ -225,29 +225,26 @@ type Params struct {
|
|||
var MainNetParams = Params{
|
||||
Name: "mainnet",
|
||||
Net: wire.MainNet,
|
||||
DefaultPort: "8333",
|
||||
DefaultPort: "9246",
|
||||
DNSSeeds: []DNSSeed{
|
||||
{"seed.bitcoin.sipa.be", true},
|
||||
{"dnsseed.bluematt.me", true},
|
||||
{"dnsseed.bitcoin.dashjr.org", false},
|
||||
{"seed.bitcoinstats.com", true},
|
||||
{"seed.bitnodes.io", false},
|
||||
{"seed.bitcoin.jonasschnelli.ch", true},
|
||||
{"dnsseed1.lbry.com", true},
|
||||
{"dnsseed2.lbry.com", true},
|
||||
{"dnsseed3.lbry.com", true},
|
||||
},
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock: &genesisBlock,
|
||||
GenesisHash: &genesisHash,
|
||||
PowLimit: mainPowLimit,
|
||||
PowLimitBits: 0x1d00ffff,
|
||||
BIP0034Height: 227931, // 000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8
|
||||
PowLimitBits: 0x1f00ffff,
|
||||
BIP0034Height: 1, // 000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8
|
||||
BIP0065Height: 388381, // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
|
||||
BIP0066Height: 363725, // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
|
||||
CoinbaseMaturity: 100,
|
||||
SubsidyReductionInterval: 210000,
|
||||
TargetTimespan: time.Hour * 24 * 14, // 14 days
|
||||
TargetTimePerBlock: time.Minute * 10, // 10 minutes
|
||||
RetargetAdjustmentFactor: 4, // 25% less, 400% more
|
||||
SubsidyReductionInterval: 1 << 5,
|
||||
TargetTimespan: time.Second * 150, // retarget every block
|
||||
TargetTimePerBlock: time.Second * 150, // 150 seconds
|
||||
RetargetAdjustmentFactor: 4, // 25% less, 400% more
|
||||
ReduceMinDifficulty: false,
|
||||
MinDiffReductionTime: 0,
|
||||
GenerateSupported: false,
|
||||
|
@ -300,8 +297,8 @@ var MainNetParams = Params{
|
|||
},
|
||||
DeploymentSegwit: {
|
||||
BitNumber: 1,
|
||||
StartTime: 1479168000, // November 15, 2016 UTC
|
||||
ExpireTime: 1510704000, // November 15, 2017 UTC.
|
||||
StartTime: 1547942400, // Jan 20, 2019
|
||||
ExpireTime: 1548288000, // Jan 24, 2019
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -310,22 +307,22 @@ var MainNetParams = Params{
|
|||
|
||||
// Human-readable part for Bech32 encoded segwit addresses, as defined in
|
||||
// BIP 173.
|
||||
Bech32HRPSegwit: "bc", // always bc for main net
|
||||
Bech32HRPSegwit: "lbc", // always bc for main net
|
||||
|
||||
// Address encoding magics
|
||||
PubKeyHashAddrID: 0x00, // starts with 1
|
||||
ScriptHashAddrID: 0x05, // starts with 3
|
||||
PrivateKeyID: 0x80, // starts with 5 (uncompressed) or K (compressed)
|
||||
PubKeyHashAddrID: 0x55, // starts with 1
|
||||
ScriptHashAddrID: 0x7a, // starts with 3
|
||||
PrivateKeyID: 0x1c, // starts with 5 (uncompressed) or K (compressed)
|
||||
WitnessPubKeyHashAddrID: 0x06, // starts with p2
|
||||
WitnessScriptHashAddrID: 0x0A, // starts with 7Xh
|
||||
|
||||
// BIP32 hierarchical deterministic extended key magics
|
||||
HDPrivateKeyID: [4]byte{0x04, 0x88, 0xad, 0xe4}, // starts with xprv
|
||||
HDPublicKeyID: [4]byte{0x04, 0x88, 0xb2, 0x1e}, // starts with xpub
|
||||
HDPrivateKeyID: [4]byte{0x01, 0x9c, 0x35, 0x4f}, // starts with xprv
|
||||
HDPublicKeyID: [4]byte{0x01, 0x9c, 0x31, 0x18}, // starts with xpub
|
||||
|
||||
// BIP44 coin type used in the hierarchical deterministic path for
|
||||
// address generation.
|
||||
HDCoinType: 0,
|
||||
HDCoinType: 0x8c,
|
||||
}
|
||||
|
||||
// RegressionNetParams defines the network parameters for the regression test
|
||||
|
@ -334,7 +331,7 @@ var MainNetParams = Params{
|
|||
var RegressionNetParams = Params{
|
||||
Name: "regtest",
|
||||
Net: wire.TestNet,
|
||||
DefaultPort: "18444",
|
||||
DefaultPort: "29246",
|
||||
DNSSeeds: []DNSSeed{},
|
||||
|
||||
// Chain parameters
|
||||
|
@ -346,11 +343,11 @@ var RegressionNetParams = Params{
|
|||
BIP0034Height: 100000000, // Not active - Permit ver 1 blocks
|
||||
BIP0065Height: 1351, // Used by regression tests
|
||||
BIP0066Height: 1251, // Used by regression tests
|
||||
SubsidyReductionInterval: 150,
|
||||
TargetTimespan: time.Hour * 24 * 14, // 14 days
|
||||
TargetTimePerBlock: time.Minute * 10, // 10 minutes
|
||||
RetargetAdjustmentFactor: 4, // 25% less, 400% more
|
||||
ReduceMinDifficulty: true,
|
||||
SubsidyReductionInterval: 1 << 5,
|
||||
TargetTimespan: time.Second,
|
||||
TargetTimePerBlock: time.Second,
|
||||
RetargetAdjustmentFactor: 4, // 25% less, 400% more
|
||||
ReduceMinDifficulty: false,
|
||||
MinDiffReductionTime: time.Minute * 20, // TargetTimePerBlock * 2
|
||||
GenerateSupported: true,
|
||||
|
||||
|
@ -377,7 +374,7 @@ var RegressionNetParams = Params{
|
|||
DeploymentSegwit: {
|
||||
BitNumber: 1,
|
||||
StartTime: 0, // Always available for vote
|
||||
ExpireTime: math.MaxInt64, // Never expires.
|
||||
ExpireTime: math.MaxInt64, // Never expires
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -386,7 +383,7 @@ var RegressionNetParams = Params{
|
|||
|
||||
// Human-readable part for Bech32 encoded segwit addresses, as defined in
|
||||
// BIP 173.
|
||||
Bech32HRPSegwit: "bcrt", // always bcrt for reg test net
|
||||
Bech32HRPSegwit: "rlbc", // always bcrt for reg test net
|
||||
|
||||
// Address encoding magics
|
||||
PubKeyHashAddrID: 0x6f, // starts with m or n
|
||||
|
@ -399,7 +396,7 @@ var RegressionNetParams = Params{
|
|||
|
||||
// BIP44 coin type used in the hierarchical deterministic path for
|
||||
// address generation.
|
||||
HDCoinType: 1,
|
||||
HDCoinType: 0x8c,
|
||||
}
|
||||
|
||||
// TestNet3Params defines the network parameters for the test Bitcoin network
|
||||
|
@ -408,12 +405,10 @@ var RegressionNetParams = Params{
|
|||
var TestNet3Params = Params{
|
||||
Name: "testnet3",
|
||||
Net: wire.TestNet3,
|
||||
DefaultPort: "18333",
|
||||
DefaultPort: "19246",
|
||||
DNSSeeds: []DNSSeed{
|
||||
{"testnet-seed.bitcoin.jonasschnelli.ch", true},
|
||||
{"testnet-seed.bitcoin.schildbach.de", false},
|
||||
{"seed.tbtc.petertodd.org", true},
|
||||
{"testnet-seed.bluematt.me", false},
|
||||
{"testdnsseed1.lbry.io", true},
|
||||
{"testdnsseed2.lbry.io", true},
|
||||
},
|
||||
|
||||
// Chain parameters
|
||||
|
@ -470,8 +465,8 @@ var TestNet3Params = Params{
|
|||
},
|
||||
DeploymentSegwit: {
|
||||
BitNumber: 1,
|
||||
StartTime: 1462060800, // May 1, 2016 UTC
|
||||
ExpireTime: 1493596800, // May 1, 2017 UTC.
|
||||
StartTime: 1462060800, // May 1st 2016
|
||||
ExpireTime: 1493596800, // May 1st 2017
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -480,7 +475,7 @@ var TestNet3Params = Params{
|
|||
|
||||
// Human-readable part for Bech32 encoded segwit addresses, as defined in
|
||||
// BIP 173.
|
||||
Bech32HRPSegwit: "tb", // always tb for test net
|
||||
Bech32HRPSegwit: "tlbc", // always tb for test net
|
||||
|
||||
// Address encoding magics
|
||||
PubKeyHashAddrID: 0x6f, // starts with m or n
|
||||
|
@ -495,7 +490,7 @@ var TestNet3Params = Params{
|
|||
|
||||
// BIP44 coin type used in the hierarchical deterministic path for
|
||||
// address generation.
|
||||
HDCoinType: 1,
|
||||
HDCoinType: 0x8c,
|
||||
}
|
||||
|
||||
// SimNetParams defines the network parameters for the simulation test Bitcoin
|
||||
|
@ -551,7 +546,7 @@ var SimNetParams = Params{
|
|||
DeploymentSegwit: {
|
||||
BitNumber: 1,
|
||||
StartTime: 0, // Always available for vote
|
||||
ExpireTime: math.MaxInt64, // Never expires.
|
||||
ExpireTime: math.MaxInt64, // Never expires
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -560,7 +555,7 @@ var SimNetParams = Params{
|
|||
|
||||
// Human-readable part for Bech32 encoded segwit addresses, as defined in
|
||||
// BIP 173.
|
||||
Bech32HRPSegwit: "sb", // always sb for sim net
|
||||
Bech32HRPSegwit: "slbc", // always sb for sim net
|
||||
|
||||
// Address encoding magics
|
||||
PubKeyHashAddrID: 0x3f, // starts with S
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
// MaxBlockHeaderPayload is the maximum number of bytes a block header can be.
|
||||
// Version 4 bytes + Timestamp 4 bytes + Bits 4 bytes + Nonce 4 bytes +
|
||||
// PrevBlock and MerkleRoot hashes.
|
||||
const MaxBlockHeaderPayload = 16 + (chainhash.HashSize * 2)
|
||||
const MaxBlockHeaderPayload = 16 + (chainhash.HashSize * 3)
|
||||
|
||||
// BlockHeader defines information about a block and is used in the bitcoin
|
||||
// block (MsgBlock) and headers (MsgHeaders) messages.
|
||||
|
@ -29,6 +29,9 @@ type BlockHeader struct {
|
|||
// Merkle tree reference to hash of all transactions for the block.
|
||||
MerkleRoot chainhash.Hash
|
||||
|
||||
// ClaimTrie reference to hash of ClaimTrie.
|
||||
ClaimTrie chainhash.Hash
|
||||
|
||||
// Time the block was created. This is, unfortunately, encoded as a
|
||||
// uint32 on the wire and therefore is limited to 2106.
|
||||
Timestamp time.Time
|
||||
|
@ -42,7 +45,7 @@ type BlockHeader struct {
|
|||
|
||||
// blockHeaderLen is a constant that represents the number of bytes for a block
|
||||
// header.
|
||||
const blockHeaderLen = 80
|
||||
const blockHeaderLen = 112
|
||||
|
||||
// BlockHash computes the block identifier hash for the given block header.
|
||||
func (h *BlockHeader) BlockHash() chainhash.Hash {
|
||||
|
@ -56,6 +59,18 @@ func (h *BlockHeader) BlockHash() chainhash.Hash {
|
|||
return chainhash.DoubleHashH(buf.Bytes())
|
||||
}
|
||||
|
||||
// BlockPoWHash computes the block identifier hash for the given block header.
|
||||
func (h *BlockHeader) BlockPoWHash() chainhash.Hash {
|
||||
// Encode the header and double sha256 everything prior to the number of
|
||||
// transactions. Ignore the error returns since there is no way the
|
||||
// encode could fail except being out of memory which would cause a
|
||||
// run-time panic.
|
||||
buf := bytes.NewBuffer(make([]byte, 0, MaxBlockHeaderPayload))
|
||||
_ = writeBlockHeader(buf, 0, h)
|
||||
|
||||
return chainhash.LbryPoWHashH(buf.Bytes())
|
||||
}
|
||||
|
||||
// BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
|
||||
// This is part of the Message interface implementation.
|
||||
// See Deserialize for decoding block headers stored to disk, such as in a
|
||||
|
@ -115,7 +130,7 @@ func NewBlockHeader(version int32, prevHash, merkleRootHash *chainhash.Hash,
|
|||
// decoding from the wire.
|
||||
func readBlockHeader(r io.Reader, pver uint32, bh *BlockHeader) error {
|
||||
return readElements(r, &bh.Version, &bh.PrevBlock, &bh.MerkleRoot,
|
||||
(*uint32Time)(&bh.Timestamp), &bh.Bits, &bh.Nonce)
|
||||
&bh.ClaimTrie, (*uint32Time)(&bh.Timestamp), &bh.Bits, &bh.Nonce)
|
||||
}
|
||||
|
||||
// writeBlockHeader writes a bitcoin block header to w. See Serialize for
|
||||
|
@ -124,5 +139,5 @@ func readBlockHeader(r io.Reader, pver uint32, bh *BlockHeader) error {
|
|||
func writeBlockHeader(w io.Writer, pver uint32, bh *BlockHeader) error {
|
||||
sec := uint32(bh.Timestamp.Unix())
|
||||
return writeElements(w, bh.Version, &bh.PrevBlock, &bh.MerkleRoot,
|
||||
sec, bh.Bits, bh.Nonce)
|
||||
&bh.ClaimTrie, sec, bh.Bits, bh.Nonce)
|
||||
}
|
||||
|
|
|
@ -73,6 +73,10 @@ func TestBlockHeaderWire(t *testing.T) {
|
|||
0x7a, 0xc7, 0x2c, 0x3e, 0x67, 0x76, 0x8f, 0x61,
|
||||
0x7f, 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32,
|
||||
0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x29, 0xab, 0x5f, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0xf3, 0xe0, 0x01, 0x00, // Nonce
|
||||
|
@ -212,6 +216,10 @@ func TestBlockHeaderSerialize(t *testing.T) {
|
|||
0x7a, 0xc7, 0x2c, 0x3e, 0x67, 0x76, 0x8f, 0x61,
|
||||
0x7f, 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32,
|
||||
0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x29, 0xab, 0x5f, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0xf3, 0xe0, 0x01, 0x00, // Nonce
|
||||
|
|
|
@ -127,7 +127,7 @@ func TestElementWire(t *testing.T) {
|
|||
},
|
||||
{
|
||||
BitcoinNet(MainNet),
|
||||
[]byte{0xf9, 0xbe, 0xb4, 0xd9},
|
||||
[]byte{0xfa, 0xe4, 0xaa, 0xf1},
|
||||
},
|
||||
// Type not supported by the "fast" path and requires reflection.
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ func TestMessage(t *testing.T) {
|
|||
{msgGetAddr, msgGetAddr, pver, MainNet, 24},
|
||||
{msgAddr, msgAddr, pver, MainNet, 25},
|
||||
{msgGetBlocks, msgGetBlocks, pver, MainNet, 61},
|
||||
{msgBlock, msgBlock, pver, MainNet, 239},
|
||||
{msgBlock, msgBlock, pver, MainNet, 271},
|
||||
{msgInv, msgInv, pver, MainNet, 25},
|
||||
{msgGetData, msgGetData, pver, MainNet, 25},
|
||||
{msgNotFound, msgNotFound, pver, MainNet, 25},
|
||||
|
@ -103,7 +103,7 @@ func TestMessage(t *testing.T) {
|
|||
{msgFilterAdd, msgFilterAdd, pver, MainNet, 26},
|
||||
{msgFilterClear, msgFilterClear, pver, MainNet, 24},
|
||||
{msgFilterLoad, msgFilterLoad, pver, MainNet, 35},
|
||||
{msgMerkleBlock, msgMerkleBlock, pver, MainNet, 110},
|
||||
{msgMerkleBlock, msgMerkleBlock, pver, MainNet, 142},
|
||||
{msgReject, msgReject, pver, MainNet, 79},
|
||||
{msgGetCFilters, msgGetCFilters, pver, MainNet, 61},
|
||||
{msgGetCFHeaders, msgGetCFHeaders, pver, MainNet, 61},
|
||||
|
|
|
@ -92,7 +92,7 @@ func TestBlockTxHashes(t *testing.T) {
|
|||
// TestBlockHash tests the ability to generate the hash of a block accurately.
|
||||
func TestBlockHash(t *testing.T) {
|
||||
// Block 1 hash.
|
||||
hashStr := "839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
|
||||
hashStr := "0c43d89a42bdce019f545b017a5e3f06517931dac0d05d5e4be066639615ce42"
|
||||
wantHash, err := chainhash.NewHashFromStr(hashStr)
|
||||
if err != nil {
|
||||
t.Errorf("NewHashFromStr: %v", err)
|
||||
|
@ -223,16 +223,18 @@ func TestBlockWireErrors(t *testing.T) {
|
|||
{&blockOne, blockOneBytes, pver, BaseEncoding, 4, io.ErrShortWrite, io.EOF},
|
||||
// Force error in merkle root.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 36, io.ErrShortWrite, io.EOF},
|
||||
// Force error in timestamp.
|
||||
// Force error in claimtrie.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 68, io.ErrShortWrite, io.EOF},
|
||||
// Force error in timestamp.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 100, io.ErrShortWrite, io.EOF},
|
||||
// Force error in difficulty bits.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 72, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 104, io.ErrShortWrite, io.EOF},
|
||||
// Force error in header nonce.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 76, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 108, io.ErrShortWrite, io.EOF},
|
||||
// Force error in transaction count.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 80, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 112, io.ErrShortWrite, io.EOF},
|
||||
// Force error in transactions.
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 81, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, pver, BaseEncoding, 113, io.ErrShortWrite, io.EOF},
|
||||
}
|
||||
|
||||
t.Logf("Running %d tests", len(tests))
|
||||
|
@ -341,16 +343,18 @@ func TestBlockSerializeErrors(t *testing.T) {
|
|||
{&blockOne, blockOneBytes, 4, io.ErrShortWrite, io.EOF},
|
||||
// Force error in merkle root.
|
||||
{&blockOne, blockOneBytes, 36, io.ErrShortWrite, io.EOF},
|
||||
// Force error in timestamp.
|
||||
// Force error in claimtrie.
|
||||
{&blockOne, blockOneBytes, 68, io.ErrShortWrite, io.EOF},
|
||||
// Force error in timestamp.
|
||||
{&blockOne, blockOneBytes, 100, io.ErrShortWrite, io.EOF},
|
||||
// Force error in difficulty bits.
|
||||
{&blockOne, blockOneBytes, 72, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, 104, io.ErrShortWrite, io.EOF},
|
||||
// Force error in header nonce.
|
||||
{&blockOne, blockOneBytes, 76, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, 108, io.ErrShortWrite, io.EOF},
|
||||
// Force error in transaction count.
|
||||
{&blockOne, blockOneBytes, 80, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, 112, io.ErrShortWrite, io.EOF},
|
||||
// Force error in transactions.
|
||||
{&blockOne, blockOneBytes, 81, io.ErrShortWrite, io.EOF},
|
||||
{&blockOne, blockOneBytes, 113, io.ErrShortWrite, io.EOF},
|
||||
}
|
||||
|
||||
t.Logf("Running %d tests", len(tests))
|
||||
|
@ -413,6 +417,10 @@ func TestBlockOverflowErrors(t *testing.T) {
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
@ -465,7 +473,7 @@ func TestBlockSerializeSize(t *testing.T) {
|
|||
size int // Expected serialized size
|
||||
}{
|
||||
// Block with no transactions.
|
||||
{noTxBlock, 81},
|
||||
{noTxBlock, 113},
|
||||
|
||||
// First block in the mainnet block chain.
|
||||
{&blockOne, len(blockOneBytes)},
|
||||
|
@ -552,6 +560,10 @@ var blockOneBytes = []byte{
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
@ -585,5 +597,5 @@ var blockOneBytes = []byte{
|
|||
|
||||
// Transaction location information for block one transactions.
|
||||
var blockOneTxLocs = []TxLoc{
|
||||
{TxStart: 81, TxLen: 134},
|
||||
{TxStart: 113, TxLen: 134},
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ func TestHeaders(t *testing.T) {
|
|||
// Ensure max payload is expected value for latest protocol version.
|
||||
// Num headers (varInt) + max allowed headers (header length + 1 byte
|
||||
// for the number of transactions which is always 0).
|
||||
wantPayload := uint32(162009)
|
||||
wantPayload := uint32(226009)
|
||||
maxPayload := msg.MaxPayloadLength(pver)
|
||||
if maxPayload != wantPayload {
|
||||
t.Errorf("MaxPayloadLength: wrong max payload length for "+
|
||||
|
@ -88,6 +88,10 @@ func TestHeadersWire(t *testing.T) {
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
@ -250,6 +254,10 @@ func TestHeadersWireErrors(t *testing.T) {
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
@ -286,6 +294,10 @@ func TestHeadersWireErrors(t *testing.T) {
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
@ -309,7 +321,7 @@ func TestHeadersWireErrors(t *testing.T) {
|
|||
// Force error with greater than max headers.
|
||||
{maxHeaders, maxHeadersEncoded, pver, BaseEncoding, 3, wireErr, wireErr},
|
||||
// Force error with number of transactions.
|
||||
{transHeader, transHeaderEncoded, pver, BaseEncoding, 81, io.ErrShortWrite, io.EOF},
|
||||
{transHeader, transHeaderEncoded, pver, BaseEncoding, 113, io.ErrShortWrite, io.EOF},
|
||||
// Force error with included transactions.
|
||||
{transHeader, transHeaderEncoded, pver, BaseEncoding, len(transHeaderEncoded), nil, wireErr},
|
||||
}
|
||||
|
|
|
@ -227,50 +227,55 @@ func TestMerkleBlockWireErrors(t *testing.T) {
|
|||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 36,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in timestamp.
|
||||
// Force error in claimtrie.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 68,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in timestamp.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 100,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in difficulty bits.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 72,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 104,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in header nonce.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 76,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 108,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in transaction count.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 80,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 112,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in num hashes.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 84,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 116,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in hashes.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 85,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 117,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in num flag bytes.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 117,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 149,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error in flag bytes.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 118,
|
||||
&merkleBlockOne, merkleBlockOneBytes, pver, BaseEncoding, 150,
|
||||
io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
// Force error due to unsupported protocol version.
|
||||
{
|
||||
&merkleBlockOne, merkleBlockOneBytes, pverNoMerkleBlock,
|
||||
BaseEncoding, 119, wireErr, wireErr,
|
||||
BaseEncoding, 151, wireErr, wireErr,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -331,7 +336,7 @@ func TestMerkleBlockOverflowErrors(t *testing.T) {
|
|||
// allowed tx hashes.
|
||||
var buf bytes.Buffer
|
||||
WriteVarInt(&buf, pver, maxTxPerBlock+1)
|
||||
numHashesOffset := 84
|
||||
numHashesOffset := 116
|
||||
exceedMaxHashes := make([]byte, numHashesOffset)
|
||||
copy(exceedMaxHashes, merkleBlockOneBytes[:numHashesOffset])
|
||||
exceedMaxHashes = append(exceedMaxHashes, buf.Bytes()...)
|
||||
|
@ -340,7 +345,7 @@ func TestMerkleBlockOverflowErrors(t *testing.T) {
|
|||
// allowed flag bytes.
|
||||
buf.Reset()
|
||||
WriteVarInt(&buf, pver, maxFlagsPerMerkleBlock+1)
|
||||
numFlagBytesOffset := 117
|
||||
numFlagBytesOffset := 149
|
||||
exceedMaxFlagBytes := make([]byte, numFlagBytesOffset)
|
||||
copy(exceedMaxFlagBytes, merkleBlockOneBytes[:numFlagBytesOffset])
|
||||
exceedMaxFlagBytes = append(exceedMaxFlagBytes, buf.Bytes()...)
|
||||
|
@ -416,6 +421,10 @@ var merkleBlockOneBytes = []byte{
|
|||
0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67,
|
||||
0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1,
|
||||
0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot
|
||||
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, // ClaimTrie
|
||||
0x61, 0xbc, 0x66, 0x49, // Timestamp
|
||||
0xff, 0xff, 0x00, 0x1d, // Bits
|
||||
0x01, 0xe3, 0x62, 0x99, // Nonce
|
||||
|
|
|
@ -147,13 +147,13 @@ type BitcoinNet uint32
|
|||
// better idea to simply disconnect clients that are misbehaving over TCP.
|
||||
const (
|
||||
// MainNet represents the main bitcoin network.
|
||||
MainNet BitcoinNet = 0xd9b4bef9
|
||||
MainNet BitcoinNet = 0xf1aae4fa
|
||||
|
||||
// TestNet represents the regression test network.
|
||||
TestNet BitcoinNet = 0xdab5bffa
|
||||
TestNet BitcoinNet = 0xd1aae4fa
|
||||
|
||||
// TestNet3 represents the test network (version 3).
|
||||
TestNet3 BitcoinNet = 0x0709110b
|
||||
TestNet3 BitcoinNet = 0xe1aae4fa
|
||||
|
||||
// SimNet represents the simulation test network.
|
||||
SimNet BitcoinNet = 0x12141c16
|
||||
|
|
Loading…
Add table
Reference in a new issue