more cleanup
int
This commit is contained in:
parent
82c0f98235
commit
1821f8bd7a
@ -34,6 +34,8 @@ type Basecoin struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
var _ abci.Application = &Basecoin{}
|
||||
|
||||
// NewBasecoin - create a new instance of the basecoin application
|
||||
func NewBasecoin(handler basecoin.Handler, eyesCli *eyes.Client, logger log.Logger) *Basecoin {
|
||||
state := sm.NewState(eyesCli, logger.With("module", "state"))
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
package commands
|
||||
|
||||
import "encoding/hex"
|
||||
|
||||
// Returns true for non-empty hex-string prefixed with "0x"
|
||||
func isHex(s string) bool {
|
||||
if len(s) > 2 && s[:2] == "0x" {
|
||||
_, err := hex.DecodeString(s[2:])
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// StripHex remove the first two hex bytes
|
||||
func StripHex(s string) string {
|
||||
if isHex(s) {
|
||||
return s[2:]
|
||||
}
|
||||
return s
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHex(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
//test isHex
|
||||
hexNoPrefix := hex.EncodeToString([]byte("foobar"))
|
||||
hexWPrefix := "0x" + hexNoPrefix
|
||||
str := "foobar"
|
||||
strWPrefix := "0xfoobar"
|
||||
|
||||
assert.True(isHex(hexWPrefix), "isHex not identifying hex with 0x prefix")
|
||||
assert.False(isHex(hexNoPrefix), "isHex shouldn't identify hex without 0x prefix")
|
||||
assert.False(isHex(str), "isHex shouldn't identify non-hex string")
|
||||
assert.False(isHex(strWPrefix), "isHex shouldn't identify non-hex string with 0x prefix")
|
||||
assert.True(StripHex(hexWPrefix) == hexNoPrefix, "StripHex doesn't remove first two characters")
|
||||
}
|
||||
@ -63,7 +63,6 @@ type OneSig struct {
|
||||
Signed `json:"signature"`
|
||||
}
|
||||
|
||||
//Interfaces to fulfill
|
||||
var _ keys.Signable = &OneSig{}
|
||||
var _ basecoin.TxLayer = &OneSig{}
|
||||
|
||||
@ -135,7 +134,6 @@ type MultiSig struct {
|
||||
Sigs []Signed `json:"signatures"`
|
||||
}
|
||||
|
||||
//Interfaces to fulfill
|
||||
var _ keys.Signable = &MultiSig{}
|
||||
var _ basecoin.TxLayer = &MultiSig{}
|
||||
|
||||
|
||||
@ -21,10 +21,6 @@ func init() {
|
||||
RegisterImplementation(ChainTx{}, TypeChainTx, ByteChainTx)
|
||||
}
|
||||
|
||||
//Interfaces to fulfill
|
||||
var _ basecoin.TxInner = &MultiTx{}
|
||||
var _ basecoin.TxInner = &ChainTx{}
|
||||
|
||||
/**** MultiTx ******/
|
||||
|
||||
// MultiTx - a transaction containing multiple transactions
|
||||
@ -32,6 +28,8 @@ type MultiTx struct {
|
||||
Txs []basecoin.Tx `json:"txs"`
|
||||
}
|
||||
|
||||
var _ basecoin.TxInner = &MultiTx{}
|
||||
|
||||
//nolint - TxInner Functions
|
||||
func NewMultiTx(txs ...basecoin.Tx) basecoin.Tx {
|
||||
return (MultiTx{Txs: txs}).Wrap()
|
||||
@ -57,6 +55,8 @@ type ChainTx struct {
|
||||
ChainID string `json:"chain_id"`
|
||||
}
|
||||
|
||||
var _ basecoin.TxInner = &ChainTx{}
|
||||
|
||||
//nolint - TxInner Functions
|
||||
func NewChainTx(chainID string, tx basecoin.Tx) basecoin.Tx {
|
||||
return (ChainTx{Tx: tx, ChainID: chainID}).Wrap()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user