auth.AccountStore assumes go-wire; Remove GetTxBytes() from Tx
This commit is contained in:
@@ -38,8 +38,18 @@ func (app *BasecoinApp) initMultiStore() {
|
||||
|
||||
// depends on initKeys()
|
||||
func (app *BasecoinApp) initAppStore() {
|
||||
app.accStore = auth.NewAccountStore(
|
||||
app.mainStoreKey,
|
||||
types.NewAppAccountCodecFromWireCodec(app.cdc),
|
||||
accStore := auth.NewAccountStore(
|
||||
app.mainStoreKey, // where accounts are persisted.
|
||||
&types.AppAccount{}, // prototype sdk.Account.
|
||||
)
|
||||
|
||||
// If there are additional interfaces & concrete types that need to be
|
||||
// registered w/ wire.Codec, they can be registered here before the
|
||||
// accStore is sealed.
|
||||
//
|
||||
// cdc := accStore.WireCodec()
|
||||
// cdc.RegisterInterface(...)
|
||||
// cdc.RegisterConcrete(...)
|
||||
|
||||
app.accStore = accStore.Seal()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
wire "github.com/tendermint/go-wire"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
)
|
||||
@@ -12,7 +10,11 @@ var _ sdk.Account = (*AppAccount)(nil)
|
||||
type AppAccount struct {
|
||||
auth.BaseAccount
|
||||
|
||||
// Custom extensions for this application.
|
||||
// Custom extensions for this application. This is just an example of
|
||||
// extending auth.BaseAccount with custom fields.
|
||||
//
|
||||
// This is compatible with the stock auth.AccountStore, since
|
||||
// auth.AccountStore uses the flexible go-wire library.
|
||||
Name string
|
||||
}
|
||||
|
||||
@@ -23,27 +25,3 @@ func (acc AppAccount) GetName() string {
|
||||
func (acc *AppAccount) SetName(name string) {
|
||||
acc.Name = name
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
type AppAccountCodec struct {
|
||||
cdc *wire.Codec
|
||||
}
|
||||
|
||||
func NewAppAccountCodecFromWireCodec(cdc *wire.Codec) AppAccountCodec {
|
||||
return AppAccountCodec{cdc}
|
||||
}
|
||||
|
||||
func (_ AppAccountCodec) Prototype() interface{} {
|
||||
return &AppAccount{}
|
||||
}
|
||||
|
||||
func (aac AppAccountCodec) Encode(o interface{}) (bz []byte, err error) {
|
||||
return aac.cdc.MarshalBinary(o)
|
||||
}
|
||||
|
||||
func (aac AppAccountCodec) Decode(bz []byte) (o interface{}, err error) {
|
||||
o = aac.Prototype()
|
||||
err = aac.cdc.UnmarshalBinary(bz, o)
|
||||
return o, err
|
||||
}
|
||||
|
||||
@@ -101,10 +101,6 @@ func (tx dummyTx) GetSigners() []crypto.Address {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tx dummyTx) GetTxBytes() []byte {
|
||||
return tx.bytes
|
||||
}
|
||||
|
||||
func (tx dummyTx) GetSignatures() []sdk.StdSignature {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user