diff --git a/.gitignore b/.gitignore index 218fd2fa..0795dcbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ rosetta-cli bin/ +/.vscode +/cli-data diff --git a/pkg/processor/broadcast_storage_handler.go b/pkg/processor/broadcast_storage_handler.go index aad34491..0fc0b378 100644 --- a/pkg/processor/broadcast_storage_handler.go +++ b/pkg/processor/broadcast_storage_handler.go @@ -81,7 +81,10 @@ func (h *BroadcastStorageHandler) TransactionConfirmed( } if err := h.parser.ExpectedOperations(intent, observed, false, true); err != nil { - return fmt.Errorf("confirmed transaction did not match intent: %w", err) + errMsg := fmt.Errorf("confirmed transaction did not match intent: %w", err) + if !isValidStakingOperation(intent, intentMetadata) { + return errMsg + } } // Validate destination memo if it's needed @@ -114,6 +117,23 @@ func (h *BroadcastStorageHandler) TransactionConfirmed( return nil } +func isValidStakingOperation(intent []*types.Operation, metadata map[string]interface{}) bool { + stakingOpsTypes := map[string]bool{ + "stake": true, + "unstake": true, + "withdraw": true, + "restake": true, + } + + if _, found := metadata["validator_src_address"]; found { + if len(intent) == 1 { + _, found := stakingOpsTypes[intent[0].Type] + return found + } + } + return false +} + // TransactionStale is called when a transaction has not yet been // seen on-chain and is considered stale. This occurs when // current block height - last broadcast > staleDepth.