block/transaction: add network magic into the hash

We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
This commit is contained in:
Roman Khimov 2020-06-18 12:00:51 +03:00
parent 8fda6a3407
commit b483c38593
39 changed files with 244 additions and 144 deletions

View file

@ -50,7 +50,7 @@ func getTestBlocks(t *testing.T) []*block.Block {
blocks := make([]*block.Block, 0, int(nBlocks))
for i := 0; i < int(nBlocks); i++ {
_ = br.ReadU32LE()
b := &block.Block{}
b := block.New(netmode.UnitTestNet)
b.DecodeBinary(br)
require.Nil(t, br.Err)
blocks = append(blocks, b)