Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions test/send_config_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,11 @@ func TestChangePartyCACertificates(t *testing.T) {
// 6.
configUpdateBuilder, _ = configutil.NewConfigUpdateBuilder(t, dir, newConfigBlockPath)

oldUC, err := testutil.GetUserConfig(dir, partyToUpdate)
require.NoError(t, err)
oldSigner, oldCertBytes, err := testutil.LoadCryptoMaterialsFromDir(t, oldUC.MSPDir)
require.NoError(t, err)

// Override the party's crypto materials with the new ones regenerated
dstDir := filepath.Join(dir, "crypto", "ordererOrganizations", updateOrg)
err = os.RemoveAll(dstDir)
Expand Down Expand Up @@ -1474,8 +1479,6 @@ func TestChangePartyCACertificates(t *testing.T) {
totalTxNumber++
}

broadcastClient.Stop()

pullRequestSigner = signutil.CreateTestSigner(t, submittingOrg, dir)
statusUnknown = common.Status_UNKNOWN
// Pull blocks to verify all transactions are included
Expand All @@ -1488,6 +1491,14 @@ func TestChangePartyCACertificates(t *testing.T) {
Status: &statusUnknown,
Signer: pullRequestSigner,
})

// Try sending a transaction with the old certificate which should fail as the old cert is no longer trusted by the network
txContent := tx.PrepareTxWithTimestamp(totalTxNumber, 64, []byte("sessionNumber"))
env = tx.CreateSignedStructuredEnvelope(txContent, oldSigner, oldCertBytes, fmt.Sprintf("org%d", partyToUpdate))
err = broadcastClient.SendTx(env)
require.ErrorContains(t, err, "signature did not satisfy policy", "expected error when sending transaction with old certificate after CA rotation, but got no error")

broadcastClient.Stop()
}

type copyPredicate func(path string, d os.DirEntry) bool
Expand Down
Loading