Exemplo n.º 1
0
 def receive_secret(self, secret):
     """Receive the secret (preimage of hashed_secret),
     validate it, if valid, update state, construct TX4 and sig
     and send to Alice.
     """
     dummy, verifying_hash = get_coinswap_secret(raw_secret=secret)
     if not verifying_hash == self.hashed_secret:
         return (False, "Received invalid coinswap secret.")
     #Known valid; must be persisted in case recovery needed.
     self.secret = secret
     return (True, "OK")
Exemplo n.º 2
0
 def send_tx0id_hx_tx2sig(self):
     self.secret, self.hashed_secret = get_coinswap_secret()
     #any old junk
     self.send("deadbeef:0", "beefdead", None)
     return (True, "TX0id, H(X), TX2 sig pretend sent OK")