Bump required index version to 5

This commit is contained in:
Martin Boehm 2019-04-30 16:06:56 +02:00
parent 1e5ada2ebf
commit 90d7a7f2da
3 changed files with 13 additions and 6 deletions

View File

@ -265,6 +265,7 @@ type Utxo struct {
Confirmations int `json:"confirmations"` Confirmations int `json:"confirmations"`
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
Path string `json:"path,omitempty"` Path string `json:"path,omitempty"`
Locktime uint32 `json:"lockTime,omitempty"`
} }
// Utxos is array of Utxo // Utxos is array of Utxo

View File

@ -59,10 +59,7 @@
"xpub_magic_segwit_p2sh": 71979618, "xpub_magic_segwit_p2sh": 71979618,
"xpub_magic_segwit_native": 73342198, "xpub_magic_segwit_native": 73342198,
"slip44": 1, "slip44": 1,
"additional_params": { "additional_params": {}
"alternativeEstimateFee": "whatthefee",
"alternativeEstimateFeeParams": "{\"url\": \"https://whatthefee.io/data.json\", \"periodSeconds\": 60}"
}
} }
}, },
"meta": { "meta": {

View File

@ -19,7 +19,7 @@ import (
"github.com/tecbot/gorocksdb" "github.com/tecbot/gorocksdb"
) )
const dbVersion = 4 const dbVersion = 5
const packedHeightBytes = 4 const packedHeightBytes = 4
const maxAddrDescLen = 1024 const maxAddrDescLen = 1024
@ -383,11 +383,20 @@ type TxAddresses struct {
Outputs []TxOutput Outputs []TxOutput
} }
// Utxo holds information about unspent transaction output
type Utxo struct {
BtxID []byte
Vout int32
Height uint32
ValueSat big.Int
}
// AddrBalance stores number of transactions and balances of an address // AddrBalance stores number of transactions and balances of an address
type AddrBalance struct { type AddrBalance struct {
Txs uint32 Txs uint32
SentSat big.Int SentSat big.Int
BalanceSat big.Int BalanceSat big.Int
Utxos []Utxo
} }
// ReceivedSat computes received amount from total balance and sent amount // ReceivedSat computes received amount from total balance and sent amount
@ -422,7 +431,7 @@ func (d *RocksDB) GetAndResetConnectBlockStats() string {
func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses addressesMap, txAddressesMap map[string]*TxAddresses, balances map[string]*AddrBalance) error { func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses addressesMap, txAddressesMap map[string]*TxAddresses, balances map[string]*AddrBalance) error {
blockTxIDs := make([][]byte, len(block.Txs)) blockTxIDs := make([][]byte, len(block.Txs))
blockTxAddresses := make([]*TxAddresses, len(block.Txs)) blockTxAddresses := make([]*TxAddresses, len(block.Txs))
// first process all outputs so that inputs can point to txs in this block // first process all outputs so that inputs can refer to txs in this block
for txi := range block.Txs { for txi := range block.Txs {
tx := &block.Txs[txi] tx := &block.Txs[txi]
btxID, err := d.chainParser.PackTxid(tx.Txid) btxID, err := d.chainParser.PackTxid(tx.Txid)