Fix linting errors
parent
d089a84ba9
commit
3a8da67752
|
@ -1047,7 +1047,7 @@ func (w *Worker) GetFeeStats(bid string) (*FeeStats, error) {
|
|||
return nil, errors.Annotatef(err, "GetTxAddresses")
|
||||
}
|
||||
|
||||
// Caclulate total fees in Satoshis
|
||||
// Calculate total fees in Satoshis
|
||||
feeSat := big.NewInt(0)
|
||||
for _, input := range txAddresses.Inputs {
|
||||
feeSat = feeSat.Add(&input.ValueSat, feeSat)
|
||||
|
|
|
@ -125,6 +125,7 @@ func (p *DecredParser) ParseBlock(b []byte) (*bchain.Block, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ParseTxFromJson parses JSON message containing transaction and returns Tx struct
|
||||
func (p *DecredParser) ParseTxFromJson(jsonTx json.RawMessage) (*bchain.Tx, error) {
|
||||
var getTxResult GetTransactionResult
|
||||
if err := json.Unmarshal([]byte(jsonTx), &getTxResult.Result); err != nil {
|
||||
|
|
|
@ -491,11 +491,7 @@ func (d *DecredRPC) GetBlockHeader(hash string) (*bchain.BlockHeader, error) {
|
|||
return header, nil
|
||||
}
|
||||
|
||||
func (d *DecredRPC) GetBlockHeaderByHeight(height uint32) (*bchain.BlockHeader, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetBlock returns the block retreived using the provided block hash by default
|
||||
// GetBlock returns the block retrieved using the provided block hash by default
|
||||
// or using the block height if an empty hash string was provided. If the
|
||||
// requested block has less than 2 confirmation bchain.ErrBlockNotFound error
|
||||
// is returned. This rule is in places to guarrantee that only validated block
|
||||
|
@ -503,18 +499,16 @@ func (d *DecredRPC) GetBlockHeaderByHeight(height uint32) (*bchain.BlockHeader,
|
|||
func (d *DecredRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
|
||||
// Confirm if the block at provided height has at least 2 confirming blocks.
|
||||
d.mtx.Lock()
|
||||
var bestBlockHeight = d.bestBlock
|
||||
if height > bestBlockHeight {
|
||||
if height > d.bestBlock {
|
||||
bestBlock, err := d.getBestBlock()
|
||||
if err != nil || height > bestBlock.Result.Height {
|
||||
// If an error occured or the current height doesn't have a minimum
|
||||
// If an error occurred or the current height doesn't have a minimum
|
||||
// of two confirming blocks (greater than best block), quit.
|
||||
d.mtx.Unlock()
|
||||
return nil, bchain.ErrBlockNotFound
|
||||
}
|
||||
|
||||
d.bestBlock = bestBlock.Result.Height
|
||||
bestBlockHeight = bestBlock.Result.Height
|
||||
}
|
||||
d.mtx.Unlock() // Releases the lock soonest possible
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ func Test_UnpackTx(t *testing.T) {
|
|||
type testBlock struct {
|
||||
size int
|
||||
time int64
|
||||
tx []string
|
||||
tx []string
|
||||
}
|
||||
|
||||
var testParseBlockTxs = map[int]testBlock{
|
||||
|
|
|
@ -8,12 +8,14 @@ import (
|
|||
"github.com/martinboehm/btcutil/chaincfg"
|
||||
)
|
||||
|
||||
// magic numbers
|
||||
const (
|
||||
MainnetMagic wire.BitcoinNet = 0x6f746f4b
|
||||
TestnetMagic wire.BitcoinNet = 0x6f6b6f54
|
||||
RegtestMagic wire.BitcoinNet = 0x6f6b6552
|
||||
)
|
||||
|
||||
// chain parameters
|
||||
var (
|
||||
MainNetParams chaincfg.Params
|
||||
TestNetParams chaincfg.Params
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"github.com/martinboehm/btcutil/chaincfg"
|
||||
)
|
||||
|
||||
// magic numbers
|
||||
const (
|
||||
// Net Magics
|
||||
MainnetMagic wire.BitcoinNet = 0xe9fdc490
|
||||
TestnetMagic wire.BitcoinNet = 0xba657645
|
||||
|
||||
|
@ -29,6 +29,7 @@ const (
|
|||
OP_ZEROCOINSPEND = 0xc2
|
||||
)
|
||||
|
||||
// chain parameters
|
||||
var (
|
||||
MainNetParams chaincfg.Params
|
||||
TestNetParams chaincfg.Params
|
||||
|
@ -143,7 +144,7 @@ func (p *PivXParser) ParseTx(b []byte) (*bchain.Tx, error) {
|
|||
return &tx, nil
|
||||
}
|
||||
|
||||
// Parses tx and adds handling for OP_ZEROCOINSPEND inputs
|
||||
// TxFromMsgTx parses tx and adds handling for OP_ZEROCOINSPEND inputs
|
||||
func (p *PivXParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx {
|
||||
vin := make([]bchain.Vin, len(t.TxIn))
|
||||
for i, in := range t.TxIn {
|
||||
|
|
|
@ -5,15 +5,18 @@ import (
|
|||
"blockbook/bchain/coins/btc"
|
||||
"blockbook/bchain/coins/utils"
|
||||
"bytes"
|
||||
|
||||
"github.com/martinboehm/btcd/wire"
|
||||
"github.com/martinboehm/btcutil/chaincfg"
|
||||
)
|
||||
|
||||
// magic numbers
|
||||
const (
|
||||
MainnetMagic wire.BitcoinNet = 0xcbc6680f
|
||||
RegtestMagic wire.BitcoinNet = 0x377b972d
|
||||
)
|
||||
|
||||
// chain parameters
|
||||
var (
|
||||
MainNetParams chaincfg.Params
|
||||
RegtestParams chaincfg.Params
|
||||
|
|
|
@ -16,8 +16,8 @@ import (
|
|||
const (
|
||||
OpZeroCoinMint = 0xc1
|
||||
OpZeroCoinSpend = 0xc2
|
||||
OpSigmaMint = 0xc3
|
||||
OpSigmaSpend = 0xc4
|
||||
OpSigmaMint = 0xc3
|
||||
OpSigmaSpend = 0xc4
|
||||
|
||||
MainnetMagic wire.BitcoinNet = 0xe3d9fef1
|
||||
TestnetMagic wire.BitcoinNet = 0xcffcbeea
|
||||
|
|
Loading…
Reference in New Issue