(self, sender: str, open_block_number: int, balance: int)
return receiver_sig
Sign an agreement for a channel closing.
        Returns:
            channel close signature (str): a signature that can be used client-side to close
            the channel by directly calling contract's close method on-chain.
Sign an agreement for a channel closing.
        Returns:
            channel close signature (str): a signature that can be used client-side to close
            the channel by directly calling contract's close method on-chain.
Sign an agreement for a channel closing . Returns : channel close signature ( str ) : a signature that can be used client - side to close the channel by directly calling contract s close method on - chain .
def sign_close(self, sender: str, open_block_number: int, balance: int):
        """Sign an agreement for a channel closing.
        Returns:
            channel close signature (str): a signature that can be used client-side to close
            the channel by directly calling contract's close method on-chain.
        """
        assert is_checksum_address(sender)
        if (sender, open_block_number) not in self.channels:
            raise NoOpenChannel('Channel does not exist or has been closed'
                                '(sender=%s, open_block_number=%d)' % (sender, open_block_number))
        c = self.channels[sender, open_block_number]
        if c.is_closed:
            raise NoOpenChannel('Channel closing has been requested already.')
        assert balance is not None
        if c.last_signature is None:
            raise NoBalanceProofReceived('Payment has not been registered.')
        if balance != c.balance:
            raise InvalidBalanceProof('Requested closing balance does not match latest one.')
        c.is_closed = True
        c.mtime = time.time()
        receiver_sig = sign_close(
            self.private_key,
            sender,
            open_block_number,
            c.balance,
            self.channel_manager_contract.address
        )
        self.state.set_channel(c)
        self.log.info('signed cooperative closing message (sender %s, block number %s)',
                      sender, open_block_number)
        return receiver_sig
def sign_close ( self , sender : str , open_block_number : int , balance : int ) : assert is_checksum_address ( sender ) if ( sender , open_block_number ) not in self . channels : raise NoOpenChannel ( 'Channel does not exist or has been closed' '(sender=%s, open_block_number=%d)' % ( sender , open_block_number ) ) c = self . channels [ sender , open_block_number ] if c . is_closed : raise NoOpenChannel ( 'Channel closing has been requested already.' ) assert balance is not None if c . last_signature is None : raise NoBalanceProofReceived ( 'Payment has not been registered.' ) if balance != c . balance : raise InvalidBalanceProof ( 'Requested closing balance does not match latest one.' ) c . is_closed = True c . mtime = time . time ( ) receiver_sig = sign_close ( self . private_key , sender , open_block_number , c . balance , self . channel_manager_contract . address ) self . state . set_channel ( c ) self . log . info ( 'signed cooperative closing message (sender %s, block number %s)' , sender , open_block_number ) return receiver_sig