}
func (m *mainchainKeeper) processWithdrawalTx(chain *orm.Chain, block *btmTypes.Block, txIndex uint64, tx *btmTypes.Tx) error {
- /*
- ormTx := &orm.CrossTransaction{
- ChainID: chain.ID,
- DestBlockHeight: sql.NullInt64{Valid: false},
- DestBlockHash: sql.NullString{Valid: false},
- DestTxIndex: sql.NullInt64{Valid: false},
- DestTxHash: sql.NullString{Valid: false},
- // Status uint8
- }
- */
+ blockHash := block.Hash()
+
+ if err := m.db.Where(&orm.CrossTransaction{
+ ChainID: chain.ID,
+ DestTxHash: sql.NullString{tx.ID.String(), true},
+ Status: common.CrossTxSubmittedStatus,
+ }).UpdateColumn(&orm.CrossTransaction{
+ DestBlockHeight: sql.NullInt64{int64(block.Height), true},
+ DestBlockHash: sql.NullString{blockHash.String(), true},
+ DestTxIndex: sql.NullInt64{int64(txIndex), true},
+ Status: common.CrossTxCompletedStatus,
+ }).Error; err != nil {
+ return err
+ }
return nil
}