Skip to content

Instantly share code, notes, and snippets.

@gauthamzz
Created January 31, 2019 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gauthamzz/c71cd51fd460481e468f4c2172cd7fa6 to your computer and use it in GitHub Desktop.
Save gauthamzz/c71cd51fd460481e468f4c2172cd7fa6 to your computer and use it in GitHub Desktop.
def deliver_tx(self, tx):
"""Validate the transaction before mutating the state.
Args:
raw_tx: a raw string (in bytes) transaction.
"""
parts = tx.split(b'=')
if len(parts) == 2:
key, value = parts[0], parts[1]
else:
key, value = tx
self.state.db.set(prefix_key(key), value)
self.state.size += 1
return ResponseDeliverTx(code=CodeTypeOk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment