Remove unnecessary fields from simple account
This commit is contained in:
parent
d1c9b8bdb9
commit
c0445e52b0
|
@ -35,7 +35,7 @@ func NewApp1(logger log.Logger, db dbm.DB) *bapp.BaseApp {
|
||||||
// Register message routes.
|
// Register message routes.
|
||||||
// Note the handler gets access to the account store.
|
// Note the handler gets access to the account store.
|
||||||
app.Router().
|
app.Router().
|
||||||
AddRoute("bank", NewApp1Handler(keyAccount))
|
AddRoute("send", NewApp1Handler(keyAccount))
|
||||||
|
|
||||||
// Mount stores and load the latest state.
|
// Mount stores and load the latest state.
|
||||||
app.MountStoresIAVL(keyAccount)
|
app.MountStoresIAVL(keyAccount)
|
||||||
|
@ -65,7 +65,7 @@ func NewMsgSend(from, to sdk.Address, amt sdk.Coins) MsgSend {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements Msg.
|
// Implements Msg.
|
||||||
func (msg MsgSend) Type() string { return "bank" }
|
func (msg MsgSend) Type() string { return "send" }
|
||||||
|
|
||||||
// Implements Msg. Ensure the addresses are good and the
|
// Implements Msg. Ensure the addresses are good and the
|
||||||
// amount is positive.
|
// amount is positive.
|
||||||
|
@ -155,7 +155,7 @@ func handleMsgSend(ctx sdk.Context, key *sdk.KVStoreKey, msg MsgSend) sdk.Result
|
||||||
var acc2 account
|
var acc2 account
|
||||||
if bz == nil {
|
if bz == nil {
|
||||||
// Receiver account does not already exist, create a new one.
|
// Receiver account does not already exist, create a new one.
|
||||||
acc2 = account{Address: msg.To}
|
acc2 = account{}
|
||||||
} else {
|
} else {
|
||||||
// Receiver account already exists. Retrieve and decode it.
|
// Receiver account already exists. Retrieve and decode it.
|
||||||
err = json.Unmarshal(bz, &acc2)
|
err = json.Unmarshal(bz, &acc2)
|
||||||
|
@ -184,9 +184,7 @@ func handleMsgSend(ctx sdk.Context, key *sdk.KVStoreKey, msg MsgSend) sdk.Result
|
||||||
}
|
}
|
||||||
|
|
||||||
type account struct {
|
type account struct {
|
||||||
Address sdk.Address `json:"address"`
|
|
||||||
Coins sdk.Coins `json:"coins"`
|
Coins sdk.Coins `json:"coins"`
|
||||||
SequenceNumber int64 `json:"sequence"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue