Tests that protocol versions and modes of operations are matched up properly.
(t *testing.T)
| 35 | |
| 36 | // Tests that protocol versions and modes of operations are matched up properly. |
| 37 | func TestProtocolCompatibility(t *testing.T) { |
| 38 | // Define the compatibility chart |
| 39 | tests := []struct { |
| 40 | version uint |
| 41 | compatible bool |
| 42 | }{ |
| 43 | {61, true}, {62, true}, {63, true}, |
| 44 | } |
| 45 | // Make sure anything we screw up is restored |
| 46 | backup := ProtocolVersions |
| 47 | defer func() { ProtocolVersions = backup }() |
| 48 | |
| 49 | // Try all available compatibility configs and check for errors |
| 50 | for i, tt := range tests { |
| 51 | ProtocolVersions = []uint{tt.version} |
| 52 | |
| 53 | pm, _, err := newTestProtocolManager(0, nil, nil) |
| 54 | if pm != nil { |
| 55 | defer pm.Stop() |
| 56 | } |
| 57 | if (err == nil && !tt.compatible) || (err != nil && tt.compatible) { |
| 58 | t.Errorf("test %d: compatibility mismatch: have error %v, want compatibility %v", i, err, tt.compatible) |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Tests that block headers can be retrieved from a remote chain based on user queries. |
| 64 | func TestGetBlockHeaders(t *testing.T) { |
nothing calls this directly
no test coverage detected