Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Sep 14, 2022
1 parent 2e4a952 commit 34cad83
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions bitcoin/handler/bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,22 @@ func (b *Bitcoin) Lookup(ctx context.Context, req *pb.LookupRequest, rsp *pb.Loo

prev := in["prev_out"].(map[string]interface{})

script, _ := prev["script"].(string)
addr, _ := prev["addr"].(string)
spent, _ := prev["spent"].(bool)
n, _ := prev["n"].(float64)
txIndex, _ := prev["tx_index"].(float64)
value, _ := prev["value"].(float64)

rspTx.Inputs = append(rspTx.Inputs, &pb.Input{
Script: in["script"].(string),
PrevOut: &pb.Prev{
Value: int64(prev["value"].(float64)),
Script: prev["script"].(string),
Address: prev["addr"].(string),
Spent: prev["spent"].(bool),
TxIndex: int64(prev["tx_index"].(float64)),
N: int64(prev["n"].(float64)),
Value: int64(value),
Script: script,
Address: addr,
Spent: spent,
TxIndex: int64(txIndex),
N: int64(n),
},
})
}
Expand Down

0 comments on commit 34cad83

Please sign in to comment.