示例#1
0
def send_refundtransfer(channel_state, initiator, target, amount, identifier,
                        expiration, hashlock):

    msg = 'Refunds are only valid for *know and pending* transfers'
    assert hashlock in channel_state.partner_state.hashlocks_to_pendinglocks, msg

    send_mediated_transfer, merkletree = create_sendmediatedtransfer(
        channel_state,
        initiator,
        target,
        amount,
        identifier,
        expiration,
        hashlock,
    )

    mediated_transfer = send_mediated_transfer.transfer
    lock = mediated_transfer.lock

    channel_state.our_state.balance_proof = mediated_transfer.balance_proof
    channel_state.our_state.merkletree = merkletree
    channel_state.our_state.hashlocks_to_pendinglocks[lock.hashlock] = lock

    refund_transfer = refund_from_sendmediated(send_mediated_transfer)
    return refund_transfer
示例#2
0
def send_refundtransfer(
    channel_state: NettingChannelState,
    initiator: typing.InitiatorAddress,
    target: typing.TargetAddress,
    amount: typing.PaymentAmount,
    message_identifier: typing.MessageID,
    payment_identifier: typing.PaymentID,
    expiration: typing.BlockExpiration,
    secrethash: typing.SecretHash,
) -> SendRefundTransfer:
    msg = 'Refunds are only valid for *know and pending* transfers'
    assert secrethash in channel_state.partner_state.secrethashes_to_lockedlocks, msg

    send_mediated_transfer, merkletree = create_sendlockedtransfer(
        channel_state,
        initiator,
        target,
        amount,
        message_identifier,
        payment_identifier,
        expiration,
        secrethash,
    )

    mediated_transfer = send_mediated_transfer.transfer
    lock = mediated_transfer.lock

    channel_state.our_state.balance_proof = mediated_transfer.balance_proof
    channel_state.our_state.merkletree = merkletree
    channel_state.our_state.secrethashes_to_lockedlocks[lock.secrethash] = lock

    refund_transfer = refund_from_sendmediated(send_mediated_transfer)
    return refund_transfer
示例#3
0
def send_refundtransfer(channel_state, initiator, target, amount,
                        message_identifier, payment_identifier, expiration,
                        secrethash):

    msg = 'Refunds are only valid for *know and pending* transfers'
    assert secrethash in channel_state.partner_state.secrethashes_to_lockedlocks, msg

    send_mediated_transfer, merkletree = create_sendlockedtransfer(
        channel_state,
        initiator,
        target,
        amount,
        message_identifier,
        payment_identifier,
        expiration,
        secrethash,
    )

    mediated_transfer = send_mediated_transfer.transfer
    lock = mediated_transfer.lock

    channel_state.our_state.balance_proof = mediated_transfer.balance_proof
    channel_state.our_state.merkletree = merkletree
    channel_state.our_state.secrethashes_to_lockedlocks[lock.secrethash] = lock

    refund_transfer = refund_from_sendmediated(send_mediated_transfer)
    return refund_transfer