Browse Source

check-source: include tests, libdir.

And fix the resulting issues.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
20a07d860a
  1. 2
      lightningd/Makefile
  2. 1
      lightningd/test/Makefile
  3. 19
      lightningd/test/run-commit_tx.c
  4. 3
      lightningd/test/run-funding_tx.c
  5. 2
      lightningd/test/run-key_derive.c

2
lightningd/Makefile

@ -96,7 +96,7 @@ check-source: $(LIGHTNINGD_SRC:%=check-src-include-order/%)
check-source: $(LIGHTNINGD_LIB_SRC:%=check-src-include-order/%)
check-source: $(LIGHTNINGD_CLI_SRC:%=check-src-include-order/%)
check-source: $(LIGHTNINGD_HEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_SRC:%=bolt-check/%) $(LIGHTNINGD_HEADERS_NOGEN:%=bolt-check/%)
check-source-bolt: $(LIGHTNINGD_SRC:%=bolt-check/%) $(LIGHTNINGD_LIB_SRC:%=bolt-check/%) $(LIGHTNINGD_HEADERS_NOGEN:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_SRC:%=check-whitespace/%) $(LIGHTNINGD_HEADERS_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_LIB_SRC:%=check-whitespace/%) $(LIGHTNINGD_LIB_HEADERS:%=check-whitespace/%)

1
lightningd/test/Makefile

@ -35,3 +35,4 @@ lightningd-test-shutdown-2: lightningd-test-2-basic\ --reconnect
lightningd-blackbox-tests: lightningd-test-shutdown-0 #lightningd-test-shutdown-1 lightningd-test-shutdown-2
check-source-bolt: $(LIGHTNINGD_TEST_SRC:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_TEST_SRC:%=check-whitespace/%)

19
lightningd/test/run-commit_tx.c

@ -109,11 +109,10 @@ static const struct htlc **setup_htlcs(const tal_t *ctx)
htlc->msatoshi = 4000000;
break;
}
if (i == 0 || i == 1 || i == 4) {
/* direction: remote->local */
} else {
/* direction: local->remote */
htlc->state = SENT_ADD_ACK_REVOCATION;
@ -372,7 +371,7 @@ int main(void)
/* BOLT #3:
*
* # Appendix C: Commitment and HTLC Transaction Test Vectors
*
*
* In the following:
* - we consider *local* transactions, which implies that all payments
* to *local* are delayed
@ -383,11 +382,11 @@ int main(void)
*
* - transaction signatures are all deterministic, using
* RFC6979 (using HMAC-SHA256)
*
*
* We start by defining common basic parameters for each test vector:
* the HTLCs are not used for the first "simple commitment tx with no
* HTLCs" test.
*
*
* funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
* funding_output_index: 0
* funding_amount_satoshi: 10000000
@ -412,7 +411,7 @@ int main(void)
* it's not required for this test. They're included here for
* completeness and in case someone wants to reproduce the test
* vectors themselves:
*
*
* INTERNAL: remote_funding_privkey: 1552dfba4f6cf29a62a0af13c8d6981d36d0ef8d61ba10fb0fe90da7634d7e130101
* INTERNAL: local_payment_basepoint_secret: 111111111111111111111111111111111111111111111111111111111111111101
* INTERNAL: local_revocation_basepoint_secret: 222222222222222222222222222222222222222222222222222222222222222201
@ -533,7 +532,7 @@ int main(void)
abort();
printf("local_funding_pubkey: %s\n",
type_to_string(tmpctx, struct pubkey, &local_funding_pubkey));
if (!pubkey_from_privkey(&x_remote_funding_privkey, &remote_funding_pubkey))
abort();
printf("remote_funding_pubkey: %s\n",
@ -818,8 +817,8 @@ int main(void)
feerate_per_kw,
htlc_map);
break;
}
}
/* No memory leaks please */
secp256k1_context_destroy(secp256k1_ctx);
tal_free(tmpctx);

3
lightningd/test/run-funding_tx.c

@ -53,7 +53,6 @@ int main(void)
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
| SECP256K1_CONTEXT_SIGN);
/* BOLT #3:
*
* Block 1 coinbase transaction: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0100f2052a010000001976a9143ca33c2e4446f4a305f23c80df8ad1afdcf652f988ac00000000
@ -77,7 +76,7 @@ int main(void)
/* BOLT #3:
*
* The funding transaction is paid to the following keys:
*
*
* local_funding_pubkey: 023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb
* remote_funding_pubkey: 030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1
*/

2
lightningd/test/run-key_derive.c

@ -23,7 +23,7 @@ int main(void)
{
struct privkey base_secret, per_commitment_secret, privkey;
struct pubkey base_point, per_commitment_point, pubkey, pubkey2;
tmpctx = tal_tmpctx(NULL);
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
| SECP256K1_CONTEXT_SIGN);

Loading…
Cancel
Save