ingest: make zmq client store raw transaction data

This commit is contained in:
George Tankersley
2018-12-14 21:54:33 -05:00
parent d4d991a191
commit 71c0624abe
4 changed files with 54 additions and 21 deletions

View File

@@ -9,8 +9,8 @@ import (
)
type block struct {
hdr *blockHeader
vtx []*transaction
hdr *blockHeader
vtx []*Transaction
}
func NewBlock() *block {
@@ -25,6 +25,11 @@ func (b *block) GetTxCount() int {
return len(b.vtx)
}
func (b *block) Transactions() []*Transaction {
// TODO: these should NOT be mutable
return b.vtx
}
// GetDisplayHash returns the block hash in big-endian display order.
func (b *block) GetDisplayHash() []byte {
return b.hdr.GetDisplayHash()
@@ -101,7 +106,7 @@ func (b *block) ParseFromSlice(data []byte) (rest []byte, err error) {
}
data = []byte(s)
vtx := make([]*transaction, 0, txCount)
vtx := make([]*Transaction, 0, txCount)
for i := 0; len(data) > 0; i++ {
tx := NewTransaction()
data, err = tx.ParseFromSlice(data)