Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Fixed AccountState Sync Issue #985

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion neo/Core/Blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ async def Persist(self, block):
sc.Items.append(SpentCoinItem(input.PrevIndex, block.Index))

output = prevTx.outputs[input.PrevIndex]
acct = snapshot.Accounts.GetAndChange(prevTx.outputs[input.PrevIndex].AddressBytes, AccountState(output.ScriptHash))
acct = snapshot.Accounts.GetAndChange(prevTx.outputs[input.PrevIndex].AddressBytes, lambda: AccountState(output.ScriptHash))
assetid = prevTx.outputs[input.PrevIndex].AssetId
acct.SubtractFromBalance(assetid, prevTx.outputs[input.PrevIndex].Value)

Expand Down
2 changes: 1 addition & 1 deletion neo/Utils/BlockchainFixtureTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def MonkeyPatchPersist(self, block, snapshot=None):
sc.Items.append(SpentCoinItem(input.PrevIndex, block.Index))

output = prevTx.outputs[input.PrevIndex]
acct = snapshot.Accounts.GetAndChange(prevTx.outputs[input.PrevIndex].AddressBytes, AccountState(output.ScriptHash))
acct = snapshot.Accounts.GetAndChange(prevTx.outputs[input.PrevIndex].AddressBytes, lambda: AccountState(output.ScriptHash))
assetid = prevTx.outputs[input.PrevIndex].AssetId
acct.SubtractFromBalance(assetid, prevTx.outputs[input.PrevIndex].Value)

Expand Down