Skip to content

Commit

Permalink
helper ctor for invpayload
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Nov 11, 2014
1 parent 0c01561 commit 750dece
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions NBitcoin/Protocol/Payloads/InvPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ public class InvPayload : Payload, IBitcoinSerializable
public InvPayload()
{

}
public InvPayload(params Transaction[] transactions)
: this(transactions.Select(tx => new InventoryVector(InventoryType.MSG_TX, tx.GetHash())).ToArray())
{

}
public InvPayload(params Block[] blocks)
: this(blocks.Select(b => new InventoryVector(InventoryType.MSG_BLOCK, b.GetHash())).ToArray())
{

}
public InvPayload(InventoryType type, params uint256[] hashes)
: this(hashes.Select(h => new InventoryVector(type, h)).ToArray())
{

}
public InvPayload(params InventoryVector[] invs)
{
Expand Down

0 comments on commit 750dece

Please sign in to comment.