import (
"bytes"
+ "encoding/json"
"math/big"
"github.com/jinzhu/gorm"
endHeight uint64
}
+type memo struct {
+ StartHeight uint64 `json:"start_height"`
+ EndHeight uint64 `json:"end_height"`
+ NodePubkey string `json:"node_pubkey"`
+ RewardRatio uint64 `json:"reward_ratio"`
+}
+
func NewSettlementReward(db *gorm.DB, cfg *config.Config, startHeight, endHeight uint64) *SettlementReward {
return &SettlementReward{
db: db,
return errNotRewardTx
}
+ data, err := json.Marshal(&memo{
+ StartHeight: s.startHeight,
+ EndHeight: s.endHeight,
+ NodePubkey: s.rewardCfg.XPub,
+ RewardRatio: s.rewardCfg.RewardRatio,
+ })
+ if err != nil {
+ return err
+ }
+
// send transactions
- _, err := s.node.BatchSendBTM(s.rewardCfg.AccountID, s.rewardCfg.Password, s.rewards)
+ _, err = s.node.BatchSendBTM(s.rewardCfg.AccountID, s.rewardCfg.Password, s.rewards, data)
return err
}