package bech32
import (
+ "fmt"
"strings"
"testing"
)
{"abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw", true},
{"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j", true},
{"split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", true},
- {"split1checkupstagehandshakeupstreamerranterredcaperred2y9e2w", false}, // invalid checksum
- {"s lit1checkupstagehandshakeupstreamerranterredcaperredp8hs2p", false}, // invalid character (space) in hrp
- {"spl" + string(127) + "t1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", false}, // invalid character (DEL) in hrp
- {"split1cheo2y9e2w", false}, // invalid character (o) in data part
- {"split1a2y9w", false}, // too short data part
+ {"split1checkupstagehandshakeupstreamerranterredcaperred2y9e2w", false}, // invalid checksum
+ {"s lit1checkupstagehandshakeupstreamerranterredcaperredp8hs2p", false}, // invalid character (space) in hrp
+ {"spl" + fmt.Sprint(127) + "t1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", false}, // invalid character (DEL) in hrp
+ {"split1cheo2y9e2w", false}, // invalid character (o) in data part
+ {"split1a2y9w", false}, // too short data part
{"1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", false}, // empty hrp
{"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j", false}, // too long
}
"testing"
"github.com/bytom/bytom/accesstoken"
- "github.com/bytom/bytom/errors"
dbm "github.com/bytom/bytom/database/leveldb"
+ "github.com/bytom/bytom/errors"
)
func TestAuthenticate(t *testing.T) {
}
if m.status.BestHash != block.PreviousBlockHash {
- log.WithFields(log.Fields{"module": logModule, "blockHeight": block.Height, "previousBlockHash": m.status.BestHash, "rcvBlockPrevHash": block.PreviousBlockHash}).Warning("The previousBlockHash of the received block is not the same as the hash of the previous block")
+ log.WithFields(log.Fields{
+ "module": logModule,
+ "block_height": block.Height,
+ "status_block_hash": m.status.BestHash.String(),
+ "retrive_block_PrevHash": block.PreviousBlockHash.String(),
+ }).Warning("The previousBlockHash of the received block is not the same as the hash of the previous block")
continue
}
defer r.Body.Close() // nolint: errcheck
if r.StatusCode >= 400 {
- err = errors.New(string(r.StatusCode))
+ err = errors.New(fmt.Sprint(r.StatusCode))
return
}
var root Root
func CreateCoinbaseTx(controlProgram []byte, height, txsFee uint64) (*types.Tx, error) {
coinbaseValue := consensus.BlockSubsidy(height) + txsFee
builder := txbuilder.NewBuilder(time.Now())
- if err := builder.AddInput(types.NewCoinbaseInput([]byte(string(height))), &txbuilder.SigningInstruction{}); err != nil {
+ if err := builder.AddInput(types.NewCoinbaseInput([]byte(fmt.Sprint(height))), &txbuilder.SigningInstruction{}); err != nil {
return nil, err
}
if err := builder.AddOutput(types.NewTxOutput(*consensus.BTMAssetID, coinbaseValue, controlProgram)); err != nil {
"github.com/bytom/bytom/account"
"github.com/bytom/bytom/consensus"
+ dbm "github.com/bytom/bytom/database/leveldb"
"github.com/bytom/bytom/protocol/bc"
"github.com/bytom/bytom/protocol/bc/types"
"github.com/bytom/bytom/testutil"
- dbm "github.com/bytom/bytom/database/leveldb"
)
func TestGetAccountUtxos(t *testing.T) {
ControlProgramIndex: 53,
Change: true,
},
- &account.UTXO{
- ControlProgram: []byte{0x91},
- AssetID: bc.AssetID{V0: 1},
- Amount: 4,
- },
},
},
{
Amount: 3,
},
},
- wantUtxos: []*account.UTXO{
- &account.UTXO{
- ControlProgram: []byte{0x91},
- AssetID: bc.AssetID{V0: 1},
- Amount: 3,
- },
- },
+ wantUtxos: []*account.UTXO{},
},
{
dbPrograms: map[string]*account.CtrlProgram{