mirror of https://github.com/status-im/nim-abc.git
Rename TxOutput.amount -> TxOutput.value
This commit is contained in:
parent
a7ef3b6b34
commit
96908b01b5
|
@ -19,7 +19,7 @@ type
|
|||
owner: PublicKey
|
||||
TxOutput* = tuple
|
||||
owner: PublicKey
|
||||
amount: UInt256
|
||||
value: UInt256
|
||||
TxHash* = distinct MDigest[256]
|
||||
|
||||
func `==`*(a, b: TxHash): bool {.borrow.}
|
||||
|
@ -60,9 +60,9 @@ func toBytes*(transaction: Transaction): seq[byte] =
|
|||
result.add(txHash.toBytes)
|
||||
result.add(owner.toBytes)
|
||||
result.add(transaction.outputs.len.uint8)
|
||||
for (owner, amount) in transaction.outputs:
|
||||
for (owner, value) in transaction.outputs:
|
||||
result.add(owner.toBytes)
|
||||
result.add(amount.toBytes)
|
||||
result.add(value.toBytes)
|
||||
|
||||
func hash*(transaction: Transaction): TxHash =
|
||||
TxHash(sha256.digest(transaction.toBytes))
|
||||
|
|
|
@ -6,10 +6,10 @@ func checkValue(store: TxStore, transaction: Transaction): bool =
|
|||
for (hash, owner) in transaction.inputs:
|
||||
for output in store[hash].outputs:
|
||||
if output.owner == owner:
|
||||
valueIn += output.amount
|
||||
valueIn += output.value
|
||||
|
||||
for (_, amount) in transaction.outputs:
|
||||
valueOut += amount
|
||||
for (_, value) in transaction.outputs:
|
||||
valueOut += value
|
||||
|
||||
valueIn == valueOut
|
||||
|
||||
|
|
Loading…
Reference in New Issue