storage: begin implementing sqlite3 storage
This commit is contained in:
@@ -35,6 +35,15 @@ func (b *block) getEncodableHash() []byte {
|
||||
return b.hdr.getEncodableHash()
|
||||
}
|
||||
|
||||
func (b *block) HasSaplingTransactions() bool {
|
||||
for _, tx := range b.vtx {
|
||||
if tx.HasSaplingTransactions() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetHeight() extracts the block height from the coinbase transaction. See
|
||||
// BIP34. Returns block height on success, or -1 on error.
|
||||
func (b *block) GetHeight() int {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -57,12 +56,12 @@ func TestCompactBlocks(t *testing.T) {
|
||||
|
||||
blockJSON, err := ioutil.ReadFile("testdata/compact_blocks.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = json.Unmarshal(blockJSON, &compactTests)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, test := range compactTests {
|
||||
|
||||
@@ -296,6 +296,10 @@ func (tx *transaction) getEncodableHash() []byte {
|
||||
return digest[:]
|
||||
}
|
||||
|
||||
func (tx *transaction) HasSaplingTransactions() bool {
|
||||
return tx.version >= 4 && (len(tx.shieldedSpends)+len(tx.shieldedOutputs)) > 0
|
||||
}
|
||||
|
||||
func (tx *transaction) ToCompact(index int) *proto.CompactTx {
|
||||
ctx := &proto.CompactTx{
|
||||
Index: uint64(index), // index is contextual
|
||||
|
||||
Reference in New Issue
Block a user