UNPKG

@node-lightning/wire

Version:
48 lines 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FundingLockedMessage = void 0; const bufio_1 = require("@node-lightning/bufio"); const core_1 = require("@node-lightning/core"); const MessageType_1 = require("../MessageType"); /** * This message is sent by both participants in the channel after * the funding transaction has reached a sufficient depth (as specified * in `accept_channel` via the `minimum_depth` property). This message * enables normal operation for the channel by providing the * next `per_commitment_point` needed to generate a new commitment * transaction signature. This message may get resent upon reconnections * if no additional updates have occurred for the channel. */ class FundingLockedMessage { constructor() { /** * The type for message. funding_signed = 35 */ this.type = FundingLockedMessage.type; } /** * Deserializes the `funding_signed` message per BOLT2 */ static deserialize(buf) { const instance = new FundingLockedMessage(); const reader = new bufio_1.BufferReader(buf); reader.readUInt16BE(); // read type instance.channelId = new core_1.ChannelId(reader.readBytes(32)); instance.nextPerCommitmentPoint = reader.readBytes(33); return instance; } /** * Serializes the `funding_locked` message per BOLT2 * @returns */ serialize() { const writer = new bufio_1.BufferWriter(); writer.writeUInt16BE(this.type); writer.writeBytes(this.channelId.toBuffer()); writer.writeBytes(this.nextPerCommitmentPoint); return writer.toBuffer(); } } exports.FundingLockedMessage = FundingLockedMessage; FundingLockedMessage.type = MessageType_1.MessageType.FundingLocked; //# sourceMappingURL=FundingLockedMessage.js.map