コード例 #1
0
        public static bool confirmWithdraw(byte[] _channelId)
        {
            BasicMethods.assert(BasicMethods._isByte32(_channelId), "_channelId illegal");

            LedgerStruct.Channel        c = LedgerStruct.getChannelMap(_channelId);
            LedgerStruct.WithdrawIntent withdrawIntent = c.withdrawIntent;
            byte[]     receiver = BasicMethods.clone(withdrawIntent.receiver);
            BigInteger amount   = withdrawIntent.amount;

            byte[] recipientChannelId = BasicMethods.clone(withdrawIntent.recipientChannelId);
            withdrawIntent.receiver           = null;
            withdrawIntent.amount             = 0;
            withdrawIntent.requestTime        = 0;
            withdrawIntent.recipientChannelId = null;
            c.withdrawIntent = withdrawIntent;
            c = LedgerChannel._addWithdrawal(c, receiver, amount);
            LedgerStruct.setChannelMap(_channelId, c);
            LedgerStruct.BalanceMap balanceMap = LedgerChannel.getBalanceMapInner(c);
            ConfirmWithdrawEvent(_channelId, amount, receiver, recipientChannelId, balanceMap.deposits, balanceMap.withdrawals);

            return(true);
        }