Beispiel #1
0
 def get_candidates(self, engine: contracts.ApplicationEngine) -> None:
     array = vm.ArrayStackItem(engine.reference_counter)
     for k, v in self._get_candidates(engine.snapshot):
         struct = vm.StructStackItem(engine.reference_counter)
         struct.append(vm.ByteStringStackItem(k.to_array()))
         struct.append(vm.IntegerStackItem(v))
         array.append(struct)
     engine.push(array)
Beispiel #2
0
 def get_candidates(self, engine: contracts.ApplicationEngine) -> None:
     """
     Fetch all registered candidates, convert them to a StackItem and push them onto the evaluation stack.
     """
     array = vm.ArrayStackItem(engine.reference_counter)
     for k, v in self._get_candidates(engine.snapshot):
         struct = vm.StructStackItem(engine.reference_counter)
         struct.append(vm.ByteStringStackItem(k.to_array()))
         struct.append(vm.IntegerStackItem(v))
         array.append(struct)
     engine.push(array)