Skip to content

Commit 56be34f

Browse files
committed
Add comprehensive fee methods tests.
1 parent 9122791 commit 56be34f

2 files changed

Lines changed: 475 additions & 6 deletions

File tree

test/mocks/blocks.hpp

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,115 @@ const block block_spend_internal_2b
522522
}
523523
}
524524
};
525+
const block block_missing_prevout_2b
526+
{
527+
header
528+
{
529+
0x31323334, // version
530+
block1b.hash(), // previous_block_hash
531+
system::one_hash, // merkle_root
532+
0x41424344, // timestamp
533+
0x51525354, // bits
534+
0x61626364 // nonce
535+
},
536+
transactions
537+
{
538+
tx2b,
539+
transaction
540+
{
541+
0xb2,
542+
inputs
543+
{
544+
input
545+
{
546+
// missing prevout index.
547+
point{ tx2b.hash(false), 0x01 },
548+
script{ { { opcode::checkmultisig }, { opcode::size } } },
549+
witness{},
550+
0xb2
551+
}
552+
},
553+
outputs
554+
{
555+
output
556+
{
557+
0xb0, // fee will be 0x01
558+
script{ { { opcode::pick } } }
559+
}
560+
},
561+
0xb2
562+
}
563+
}
564+
};
565+
const block block_valid_spend_internal_2b
566+
{
567+
header
568+
{
569+
0x31323334, // version
570+
block1b.hash(), // previous_block_hash
571+
system::one_hash, // merkle_root
572+
0x41424344, // timestamp
573+
0x51525354, // bits
574+
0x61626364 // nonce
575+
},
576+
transactions
577+
{
578+
tx2b,
579+
transaction
580+
{
581+
0xb2,
582+
inputs
583+
{
584+
input
585+
{
586+
point{ tx2b.hash(false), 0x00 },
587+
script{ { { opcode::checkmultisig }, { opcode::size } } },
588+
witness{},
589+
0xb2
590+
}
591+
},
592+
outputs
593+
{
594+
output
595+
{
596+
0xb0, // fee will be 0x01
597+
script{ { { opcode::pick } } }
598+
}
599+
},
600+
0xb2
601+
},
602+
transaction
603+
{
604+
0xb2,
605+
inputs
606+
{
607+
input
608+
{
609+
point{ block1b.transactions_ptr()->front()->hash(false), 0x00 },
610+
script{ { { opcode::checkmultisig }, { opcode::size } } },
611+
witness{},
612+
0xb2
613+
},
614+
input
615+
{
616+
point{ block1b.transactions_ptr()->front()->hash(false), 0x01 },
617+
script{ { { opcode::checkmultisig } } },
618+
witness{},
619+
0xb2
620+
}
621+
},
622+
outputs
623+
{
624+
output
625+
{
626+
0xb2, // fee will be 0xb1 + 0xb1 - 0xb2 = 0xb0
627+
script{ { { opcode::pick }, { opcode::roll }, { opcode::pick } } }
628+
}
629+
},
630+
0xb2
631+
}
632+
}
633+
};
525634

526635
} // namespace test
527636

0 commit comments

Comments
 (0)