Fix statuses
This commit is contained in:
parent
b34f37b5e7
commit
27faa31c7a
3 changed files with 6 additions and 11 deletions
|
@ -516,9 +516,8 @@ func (b *Client) parseTransactions(
|
||||||
"block hash", block.Hash,
|
"block hash", block.Hash,
|
||||||
"transaction hash", transaction.Hash,
|
"transaction hash", transaction.Hash,
|
||||||
)
|
)
|
||||||
status := SuccessStatus
|
|
||||||
for _, op := range txOps {
|
for _, op := range txOps {
|
||||||
op.Status = &status
|
op.Status = types.String(SkippedStatus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,14 +674,13 @@ func (b *Client) parseOutputTransactionOperation(
|
||||||
coinChange = nil
|
coinChange = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
status := SuccessStatus
|
|
||||||
return &types.Operation{
|
return &types.Operation{
|
||||||
OperationIdentifier: &types.OperationIdentifier{
|
OperationIdentifier: &types.OperationIdentifier{
|
||||||
Index: index,
|
Index: index,
|
||||||
NetworkIndex: &networkIndex,
|
NetworkIndex: &networkIndex,
|
||||||
},
|
},
|
||||||
Type: OutputOpType,
|
Type: OutputOpType,
|
||||||
Status: &status,
|
Status: types.String(SuccessStatus),
|
||||||
Account: account,
|
Account: account,
|
||||||
Amount: &types.Amount{
|
Amount: &types.Amount{
|
||||||
Value: strconv.FormatInt(int64(amount), 10),
|
Value: strconv.FormatInt(int64(amount), 10),
|
||||||
|
@ -733,14 +731,13 @@ func (b *Client) parseInputTransactionOperation(
|
||||||
return nil, fmt.Errorf("%w: unable to negate previous output", err)
|
return nil, fmt.Errorf("%w: unable to negate previous output", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
status := SuccessStatus
|
|
||||||
return &types.Operation{
|
return &types.Operation{
|
||||||
OperationIdentifier: &types.OperationIdentifier{
|
OperationIdentifier: &types.OperationIdentifier{
|
||||||
Index: index,
|
Index: index,
|
||||||
NetworkIndex: &networkIndex,
|
NetworkIndex: &networkIndex,
|
||||||
},
|
},
|
||||||
Type: InputOpType,
|
Type: InputOpType,
|
||||||
Status: &status,
|
Status: types.String(SuccessStatus),
|
||||||
Account: accountCoin.Account,
|
Account: accountCoin.Account,
|
||||||
Amount: &types.Amount{
|
Amount: &types.Amount{
|
||||||
Value: newValue,
|
Value: newValue,
|
||||||
|
@ -796,14 +793,13 @@ func (b *Client) coinbaseTxOperation(
|
||||||
return nil, fmt.Errorf("%w: unable to get input metadata", err)
|
return nil, fmt.Errorf("%w: unable to get input metadata", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
status := SuccessStatus
|
|
||||||
return &types.Operation{
|
return &types.Operation{
|
||||||
OperationIdentifier: &types.OperationIdentifier{
|
OperationIdentifier: &types.OperationIdentifier{
|
||||||
Index: index,
|
Index: index,
|
||||||
NetworkIndex: &networkIndex,
|
NetworkIndex: &networkIndex,
|
||||||
},
|
},
|
||||||
Type: CoinbaseOpType,
|
Type: CoinbaseOpType,
|
||||||
Status: &status,
|
Status: types.String(SuccessStatus),
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ func (i *Indexer) Sync(ctx context.Context) error {
|
||||||
// If previously processed blocks exist in storage, they are fetched.
|
// If previously processed blocks exist in storage, they are fetched.
|
||||||
// Otherwise, none are provided to the cache (the syncer will not attempt
|
// Otherwise, none are provided to the cache (the syncer will not attempt
|
||||||
// a reorg if the cache is empty).
|
// a reorg if the cache is empty).
|
||||||
pastBlocks := i.blockStorage.CreateBlockCache(ctx, int(head.Index))
|
pastBlocks := i.blockStorage.CreateBlockCache(ctx, syncer.DefaultPastBlockLimit)
|
||||||
|
|
||||||
syncer := syncer.New(
|
syncer := syncer.New(
|
||||||
i.network,
|
i.network,
|
||||||
|
|
|
@ -487,7 +487,6 @@ func TestIndexer_Reorg(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
transactions := []*types.Transaction{}
|
transactions := []*types.Transaction{}
|
||||||
status := bitcoin.SuccessStatus
|
|
||||||
for j := 0; j < 5; j++ {
|
for j := 0; j < 5; j++ {
|
||||||
rawHash := fmt.Sprintf("block %d transaction %d", i, j)
|
rawHash := fmt.Sprintf("block %d transaction %d", i, j)
|
||||||
hash := fmt.Sprintf("%x", sha256.Sum256([]byte(rawHash)))
|
hash := fmt.Sprintf("%x", sha256.Sum256([]byte(rawHash)))
|
||||||
|
@ -507,7 +506,7 @@ func TestIndexer_Reorg(t *testing.T) {
|
||||||
Index: 0,
|
Index: 0,
|
||||||
NetworkIndex: &index0,
|
NetworkIndex: &index0,
|
||||||
},
|
},
|
||||||
Status: &status,
|
Status: types.String(bitcoin.SuccessStatus),
|
||||||
Type: bitcoin.OutputOpType,
|
Type: bitcoin.OutputOpType,
|
||||||
Account: &types.AccountIdentifier{
|
Account: &types.AccountIdentifier{
|
||||||
Address: rawHash,
|
Address: rawHash,
|
||||||
|
|
Loading…
Reference in a new issue