Fix statuses

This commit is contained in:
Patrick O'Grady 2020-11-13 11:29:02 -08:00
parent b34f37b5e7
commit 27faa31c7a
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85
3 changed files with 6 additions and 11 deletions

View file

@ -516,9 +516,8 @@ func (b *Client) parseTransactions(
"block hash", block.Hash,
"transaction hash", transaction.Hash,
)
status := SuccessStatus
for _, op := range txOps {
op.Status = &status
op.Status = types.String(SkippedStatus)
}
}
@ -675,14 +674,13 @@ func (b *Client) parseOutputTransactionOperation(
coinChange = nil
}
status := SuccessStatus
return &types.Operation{
OperationIdentifier: &types.OperationIdentifier{
Index: index,
NetworkIndex: &networkIndex,
},
Type: OutputOpType,
Status: &status,
Status: types.String(SuccessStatus),
Account: account,
Amount: &types.Amount{
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)
}
status := SuccessStatus
return &types.Operation{
OperationIdentifier: &types.OperationIdentifier{
Index: index,
NetworkIndex: &networkIndex,
},
Type: InputOpType,
Status: &status,
Status: types.String(SuccessStatus),
Account: accountCoin.Account,
Amount: &types.Amount{
Value: newValue,
@ -796,14 +793,13 @@ func (b *Client) coinbaseTxOperation(
return nil, fmt.Errorf("%w: unable to get input metadata", err)
}
status := SuccessStatus
return &types.Operation{
OperationIdentifier: &types.OperationIdentifier{
Index: index,
NetworkIndex: &networkIndex,
},
Type: CoinbaseOpType,
Status: &status,
Status: types.String(SuccessStatus),
Metadata: metadata,
}, nil
}

View file

@ -255,7 +255,7 @@ func (i *Indexer) Sync(ctx context.Context) error {
// If previously processed blocks exist in storage, they are fetched.
// Otherwise, none are provided to the cache (the syncer will not attempt
// 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(
i.network,

View file

@ -487,7 +487,6 @@ func TestIndexer_Reorg(t *testing.T) {
}
transactions := []*types.Transaction{}
status := bitcoin.SuccessStatus
for j := 0; j < 5; j++ {
rawHash := fmt.Sprintf("block %d transaction %d", i, j)
hash := fmt.Sprintf("%x", sha256.Sum256([]byte(rawHash)))
@ -507,7 +506,7 @@ func TestIndexer_Reorg(t *testing.T) {
Index: 0,
NetworkIndex: &index0,
},
Status: &status,
Status: types.String(bitcoin.SuccessStatus),
Type: bitcoin.OutputOpType,
Account: &types.AccountIdentifier{
Address: rawHash,