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

Commit

Permalink
Fixed AccountState Sync Issue (#985)
Browse files Browse the repository at this point in the history
* Explicitly defining `lambda` for account syncing to fix `TypeError: 'AccountState' object is not callable` errors.
  • Loading branch information
brianlenz authored and ixje committed Jul 17, 2019
1 parent c06df37 commit c79596c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit c79596c

Please sign in to comment.