Add reserve, send enclosure
This commit is contained in:
parent
1f7ca28647
commit
f8b256b51b
@ -27,6 +27,10 @@ class QueueEntry:
|
|||||||
self.synced = False
|
self.synced = False
|
||||||
|
|
||||||
|
|
||||||
|
def serialize(self):
|
||||||
|
return self.signed_tx
|
||||||
|
|
||||||
|
|
||||||
def create(self, signed_tx):
|
def create(self, signed_tx):
|
||||||
signed_tx = normalize_hex(signed_tx)
|
signed_tx = normalize_hex(signed_tx)
|
||||||
self.k = self.store.put(self.tx_hash, signed_tx)
|
self.k = self.store.put(self.tx_hash, signed_tx)
|
||||||
|
@ -46,7 +46,7 @@ class Verify:
|
|||||||
return 'already finalized'
|
return 'already finalized'
|
||||||
if from_state & state_store.IN_NETWORK:
|
if from_state & state_store.IN_NETWORK:
|
||||||
return 'already in network'
|
return 'already in network'
|
||||||
if from_state & state_store.RESERVED:
|
if not from_state & state_store.RESERVED:
|
||||||
return 'not reserved'
|
return 'not reserved'
|
||||||
if from_state & state_store.mask_error:
|
if from_state & state_store.mask_error:
|
||||||
return 'already in error state'
|
return 'already in error state'
|
||||||
|
@ -100,6 +100,12 @@ class Store:
|
|||||||
return self.by_state(state=0, limit=limit, strict=True)
|
return self.by_state(state=0, limit=limit, strict=True)
|
||||||
|
|
||||||
|
|
||||||
|
def reserve(self, k):
|
||||||
|
entry = QueueEntry(self, k)
|
||||||
|
entry.load()
|
||||||
|
entry.reserve()
|
||||||
|
|
||||||
|
|
||||||
def enqueue(self, k):
|
def enqueue(self, k):
|
||||||
entry = QueueEntry(self, k)
|
entry = QueueEntry(self, k)
|
||||||
entry.load()
|
entry.load()
|
||||||
@ -113,3 +119,16 @@ class Store:
|
|||||||
entry = QueueEntry(self, k)
|
entry = QueueEntry(self, k)
|
||||||
entry.load()
|
entry.load()
|
||||||
entry.sendfail()
|
entry.sendfail()
|
||||||
|
|
||||||
|
|
||||||
|
def send_start(self, k):
|
||||||
|
entry = QueueEntry(self, k)
|
||||||
|
entry.load()
|
||||||
|
entry.reserve()
|
||||||
|
return entry
|
||||||
|
|
||||||
|
|
||||||
|
def send_end(self, k):
|
||||||
|
entry = QueueEntry(self, k)
|
||||||
|
entry.load()
|
||||||
|
entry.sent()
|
||||||
|
Loading…
Reference in New Issue
Block a user