pull/4065/head
Lutty 3 years ago
parent 0cf8edf91d
commit a8122bb52f
  1. 50
      rosetta/services/tx_operation.go

@ -763,28 +763,20 @@ func newSameShardTransferNativeOperations(
} else { } else {
opIndex = 0 opIndex = 0
} }
subOperationID := &types.OperationIdentifier{
Index: opIndex,
}
subAmount := &types.Amount{
Value: negativeBigValue(amount),
Currency: &common.NativeCurrency,
}
// Addition operation elements var subOperationID *types.OperationIdentifier
addOperationID := &types.OperationIdentifier{ var op []*types.Operation
Index: subOperationID.Index + 1,
}
addRelatedID := []*types.OperationIdentifier{
subOperationID,
}
addAmount := &types.Amount{
Value: amount.String(),
Currency: &common.NativeCurrency,
}
op := []*types.Operation{}
if from != nil { if from != nil {
subOperationID = &types.OperationIdentifier{
Index: opIndex,
}
subAmount := &types.Amount{
Value: negativeBigValue(amount),
Currency: &common.NativeCurrency,
}
op = append(op, &types.Operation{ op = append(op, &types.Operation{
OperationIdentifier: subOperationID, OperationIdentifier: subOperationID,
Type: common.NativeTransferOperation, Type: common.NativeTransferOperation,
@ -794,6 +786,26 @@ func newSameShardTransferNativeOperations(
}) })
} }
if to != nil { if to != nil {
var addOperationID *types.OperationIdentifier
var addRelatedID []*types.OperationIdentifier
if subOperationID == nil {
addOperationID = &types.OperationIdentifier{
Index: opIndex,
}
} else {
addOperationID = &types.OperationIdentifier{
Index: subOperationID.Index + 1,
}
addRelatedID = []*types.OperationIdentifier{
subOperationID,
}
}
addAmount := &types.Amount{
Value: amount.String(),
Currency: &common.NativeCurrency,
}
op = append(op, &types.Operation{ op = append(op, &types.Operation{
OperationIdentifier: addOperationID, OperationIdentifier: addOperationID,
RelatedOperations: addRelatedID, RelatedOperations: addRelatedID,

Loading…
Cancel
Save