-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix relayer remote consumers list update
- Loading branch information
1 parent
398bf4e
commit cfb777d
Showing
5 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ var ( | |
) | ||
|
||
func TestConsensus(t *testing.T) { | ||
testConsensus(t, false) | ||
testConsensus(t, true) | ||
testConsensus(t, false) | ||
} | ||
|
||
func testConsensus(t *testing.T, withRelayers bool) { | ||
|
@@ -796,15 +796,18 @@ func setupTestNet(root string, withRelayers bool) ([]common.Address, []common.Ad | |
id := s.Hash().ForNetwork(gns.NetworkId()) | ||
peers[i] = fmt.Sprintf("%[email protected]:170%02d", id.String(), i+1) | ||
} | ||
peersList := `"` + strings.Join(peers[:len(peers)/3], `","`) + `"` | ||
peersListHead := `"` + strings.Join(peers[:len(peers)/3], `","`) + `"` | ||
peersListTail := `"` + strings.Join(peers[len(peers)/2:], `","`) + `"` | ||
|
||
if withRelayers { | ||
peers := make([]string, len(relayers)) | ||
for i, s := range relayers { | ||
id := s.Hash().ForNetwork(gns.NetworkId()) | ||
peers[i] = fmt.Sprintf("%[email protected]:160%02d", id.String(), i+1) | ||
} | ||
peersList = `"` + strings.Join(peers[:len(peers)/3], `","`) + `"` | ||
peersListHead = `"` + strings.Join(peers[:len(peers)/3], `","`) + `"` | ||
peersListTail = `"` + strings.Join(peers[len(peers)/2:], `","`) + `"` | ||
peersList := `"` + strings.Join(peers[:len(peers)/3], `","`) + `"` | ||
for i, a := range relayers { | ||
dir := fmt.Sprintf("%s/mixin-160%02d", root, i+1) | ||
err := os.MkdirAll(dir, 0755) | ||
|
@@ -836,7 +839,15 @@ func setupTestNet(root string, withRelayers bool) ([]common.Address, []common.Ad | |
panic(err) | ||
} | ||
|
||
isRelayer := !withRelayers && strings.Contains(peersList, fmt.Sprintf("170%02d", i+1)) | ||
peersList := peersListHead | ||
if i > len(signers)/2 { | ||
peersList = peersListTail | ||
} | ||
p2p := fmt.Sprintf("170%02d", i+1) | ||
isRelayer := !withRelayers && (strings.Contains(peersListHead, p2p) || strings.Contains(peersListTail, p2p)) | ||
if isRelayer { | ||
peersList = peersListHead | ||
} | ||
configData := []byte(fmt.Sprintf(configDataTmpl, a.PrivateSpendKey.String(), isRelayer, peersList)) | ||
err = os.WriteFile(dir+"/config.toml", configData, 0644) | ||
if err != nil { | ||
|
@@ -847,7 +858,7 @@ func setupTestNet(root string, withRelayers bool) ([]common.Address, []common.Ad | |
panic(err) | ||
} | ||
} | ||
return signers, payees, genesisData, peersList | ||
return signers, payees, genesisData, peersListHead | ||
} | ||
|
||
func testSignTransaction(node string, account common.Address, rawStr string) (*common.SignedTransaction, error) { | ||
|